* Configure Helm Source from org-tags-view
@ 2019-08-08 16:49 Nathan Neff
2019-08-08 19:00 ` Jean Louis
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Nathan Neff @ 2019-08-08 16:49 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 761 bytes --]
Hello all,
Has anyone created a Helm source from the results of org-agenda?
Specifically org-tags-view I think would be a cool Helm source to
configure where the headings that have certain tags could be displayed
by Helm.
I looked @ the code for org-tags-view and it's fairly straight forward -
however, I think
that the function itself is tightly coupled between finding the results and
displaying the
results. In other words, there's no "easy" function that I see which would
provide headings
that match a tags search that I could use as a Helm source.
I think I would need to copy quite a bit of code from org-tags-view into a
different
function to create a Helm source. Am I missing something?
Has anyone else done something similar?
Thanks,
--Nate
[-- Attachment #2: Type: text/html, Size: 1045 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 16:49 Configure Helm Source from org-tags-view Nathan Neff
@ 2019-08-08 19:00 ` Jean Louis
2019-08-08 19:13 ` Jean Louis
2019-08-09 11:07 ` Adam Porter
2 siblings, 0 replies; 13+ messages in thread
From: Jean Louis @ 2019-08-08 19:00 UTC (permalink / raw)
To: Nathan Neff; +Cc: emacs-orgmode
* Nathan Neff <nathan.neff@gmail.com> [2019-08-08 18:50]:
> Hello all,
>
> Has anyone created a Helm source from the results of org-agenda?
>
> Specifically org-tags-view I think would be a cool Helm source to
> configure where the headings that have certain tags could be displayed
> by Helm.
>
> I looked @ the code for org-tags-view and it's fairly straight
> forward - however, I think that the function itself is tightly
> coupled between finding the results and displaying the results. In
> other words, there's no easy function that I see which would provide
> headings that match a tags search that I could use as a Helm source.
I almost never use the tags view. But now I have tried it. I
understand.
Maybe you find out what is the result or evaluation that creates that
list, maybe it is some list of lists, and it could get ready for HELM
completion with few tweaks.
Jean
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 16:49 Configure Helm Source from org-tags-view Nathan Neff
2019-08-08 19:00 ` Jean Louis
@ 2019-08-08 19:13 ` Jean Louis
2019-08-08 20:03 ` Nathan Neff
2019-08-09 11:07 ` Adam Porter
2 siblings, 1 reply; 13+ messages in thread
From: Jean Louis @ 2019-08-08 19:13 UTC (permalink / raw)
To: Nathan Neff; +Cc: emacs-orgmode
* Nathan Neff <nathan.neff@gmail.com> [2019-08-08 18:50]:
> Hello all,
>
> Has anyone created a Helm source from the results of org-agenda?
>
> Specifically org-tags-view I think would be a cool Helm source to
> configure where the headings that have certain tags could be displayed
> by Helm.
>
> I looked @ the code for org-tags-view and it's fairly straight
> forward - however, I think that the function itself is tightly
> coupled between finding the results and displaying the results. In
> other words, there's no easy function that I see which would provide
> headings that match a tags search that I could use as a Helm source.
If tag is 'staff, this below will give structure out:
(org-scan-tags 'agenda '(staff lambda (todo tags-list level) (progn
(setq org-cached-props nil) (or (and (member staff tags-list)))))
org--matcher-tags-todo-only)
Now `org-scan-tags` could be inspected if it constructs some lists,
alist, that are somewhat nicer than such output.
But that output can be converted to HELM completion.
Jean
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 19:13 ` Jean Louis
@ 2019-08-08 20:03 ` Nathan Neff
2019-08-08 20:23 ` Nathan Neff
2019-08-08 20:29 ` Jean Louis
0 siblings, 2 replies; 13+ messages in thread
From: Nathan Neff @ 2019-08-08 20:03 UTC (permalink / raw)
To: Jean Louis; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2158 bytes --]
Hi Jean,
Thank you - however, I can't get this function to return anything.
org-scan-tags accepts an action, a matcher and a todo-only.
Code:
(org-scan-tags 'agenda ;; Action
'(staff lambda (todo tags-list level) ;; Matcher
(progn
(setq org-cached-props nil)
(or (and (member staff tags-list)))))
;; End Matcher
org--matcher-tags-todo-only) ;; Todo-only
* To my knowledge, the 'agenda is the action, and the list starting with
`(staff <snip>) is the matcher.
* Why does the tag I'm searching for ("staff") appear as the first "atom"
in the
"matcher" parameter? Why isn't it just a lambda?
* I don't quite understand what the "or" and "and" are doing. It seems like
I don't need either of them.
My org-agenda-files contains files and I have a headline with the tag
"staff"
- no quotes, and the function's not returning anything.
Thanks,
--Nate
On Thu, Aug 8, 2019 at 2:13 PM Jean Louis <bugs@gnu.support> wrote:
> * Nathan Neff <nathan.neff@gmail.com> [2019-08-08 18:50]:
> > Hello all,
> >
> > Has anyone created a Helm source from the results of org-agenda?
> >
> > Specifically org-tags-view I think would be a cool Helm source to
> > configure where the headings that have certain tags could be displayed
> > by Helm.
> >
> > I looked @ the code for org-tags-view and it's fairly straight
> > forward - however, I think that the function itself is tightly
> > coupled between finding the results and displaying the results. In
> > other words, there's no easy function that I see which would provide
> > headings that match a tags search that I could use as a Helm source.
>
> If tag is 'staff, this below will give structure out:
>
> (org-scan-tags 'agenda '(staff lambda (todo tags-list level) (progn
> (setq org-cached-props nil) (or (and (member staff tags-list)))))
> org--matcher-tags-todo-only)
>
> Now `org-scan-tags` could be inspected if it constructs some lists,
> alist, that are somewhat nicer than such output.
>
> But that output can be converted to HELM completion.
>
> Jean
>
[-- Attachment #2: Type: text/html, Size: 3205 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 20:03 ` Nathan Neff
@ 2019-08-08 20:23 ` Nathan Neff
2019-08-08 20:30 ` Jean Louis
2019-08-08 20:29 ` Jean Louis
1 sibling, 1 reply; 13+ messages in thread
From: Nathan Neff @ 2019-08-08 20:23 UTC (permalink / raw)
To: Jean Louis; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 3085 bytes --]
Okay, I got this to work in org-babel in a file foo.org
that has headlines like this:
* Foo.org :bar:
#+BEGIN_SRC emacs-lisp
(org-scan-tags 'agenda ;; Action
'(lambda (todo tags-list level) ;; Matcher
(progn
(setq org-cached-props nil)
(member "bar" tags-list))) ;; End
Matcher
org--matcher-tags-todo-only) ;; Todo-only
#+END_SRC
I removed the "staff" from the beginning of the function call, and changed
staff to "bar" I also removed the (or (and)) conditions :-)
Now, I need to see how to make this function search all agenda files - it
seems
to work only on the headlines in Foo.org
Thanks,
--Nate
On Thu, Aug 8, 2019 at 3:03 PM Nathan Neff <nathan.neff@gmail.com> wrote:
> Hi Jean,
>
> Thank you - however, I can't get this function to return anything.
>
> org-scan-tags accepts an action, a matcher and a todo-only.
>
> Code:
>
> (org-scan-tags 'agenda ;; Action
> '(staff lambda (todo tags-list level) ;; Matcher
> (progn
> (setq org-cached-props nil)
> (or (and (member staff tags-list)))))
> ;; End Matcher
> org--matcher-tags-todo-only) ;; Todo-only
>
> * To my knowledge, the 'agenda is the action, and the list starting with
> `(staff <snip>) is the matcher.
> * Why does the tag I'm searching for ("staff") appear as the first "atom"
> in the
> "matcher" parameter? Why isn't it just a lambda?
> * I don't quite understand what the "or" and "and" are doing. It seems
> like
> I don't need either of them.
>
> My org-agenda-files contains files and I have a headline with the tag
> "staff"
> - no quotes, and the function's not returning anything.
>
> Thanks,
> --Nate
>
>
> On Thu, Aug 8, 2019 at 2:13 PM Jean Louis <bugs@gnu.support> wrote:
>
>> * Nathan Neff <nathan.neff@gmail.com> [2019-08-08 18:50]:
>> > Hello all,
>> >
>> > Has anyone created a Helm source from the results of org-agenda?
>> >
>> > Specifically org-tags-view I think would be a cool Helm source to
>> > configure where the headings that have certain tags could be displayed
>> > by Helm.
>> >
>> > I looked @ the code for org-tags-view and it's fairly straight
>> > forward - however, I think that the function itself is tightly
>> > coupled between finding the results and displaying the results. In
>> > other words, there's no easy function that I see which would provide
>> > headings that match a tags search that I could use as a Helm source.
>>
>> If tag is 'staff, this below will give structure out:
>>
>> (org-scan-tags 'agenda '(staff lambda (todo tags-list level) (progn
>> (setq org-cached-props nil) (or (and (member staff tags-list)))))
>> org--matcher-tags-todo-only)
>>
>> Now `org-scan-tags` could be inspected if it constructs some lists,
>> alist, that are somewhat nicer than such output.
>>
>> But that output can be converted to HELM completion.
>>
>> Jean
>>
>
[-- Attachment #2: Type: text/html, Size: 4707 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 20:03 ` Nathan Neff
2019-08-08 20:23 ` Nathan Neff
@ 2019-08-08 20:29 ` Jean Louis
1 sibling, 0 replies; 13+ messages in thread
From: Jean Louis @ 2019-08-08 20:29 UTC (permalink / raw)
To: Nathan Neff; +Cc: emacs-orgmode
* Nathan Neff <nathan.neff@gmail.com> [2019-08-08 22:04]:
> Hi Jean,
>
> Thank you - however, I can't get this function to return anything.
>
> org-scan-tags accepts an action, a matcher and a todo-only.
>
> Code:
>
> (org-scan-tags 'agenda ;; Action
> '(staff lambda (todo tags-list level) ;; Matcher
> (progn
> (setq org-cached-props nil)
> (or (and (member staff tags-list)))))
> ;; End Matcher
> org--matcher-tags-todo-only) ;; Todo-only
>
> * To my knowledge, the 'agenda is the action, and the list starting with
> `(staff <snip>) is the matcher.
If you do not have tag "staff" you cannot find anything. So change it
to your own tag. But now after reading I see you have it actually
And function is not going to work outside Org buffer. So I have
evaluated it with M-:
In fact I did following:
(setq a (org-scan-tags 'agenda '(staff lambda (todo tags-list level) (progn (setq org-cached-props nil) (or (and (member staff tags-list))))) org--matcher-tags-todo-only))
Then I have inspected 'a' in scratch buffer.
I see that it has various properties for faces, so is not quite the
best output.
> * Why does the tag I'm searching for (staff) appear as the first
> atom in the matcher parameter? Why isn't it just a lambda?
Me not developer.
> * I don't quite understand what the or and and are doing. It seems
> like I don't need either of them.
I just tried giving some pointers, so in org-scan-tags is probably the
solution.
When I looked at that function I got fascinated with the type of
programming that I don't like, maybe it is common in Emacs Lisp, but
not what I used to learn from Common Lisp. And I program in Emacs Lisp
in such way that one function evaluates and gives out some results. I
do not work with global variables from within functions.
I was programming in Perl and I stopped the nonsense, but not quite
"just in time". When looking at that function org-scan-tags it looks
to me as Perl. It is LISP without its beauty. I keep functions small
and simple.
My knowledge about "right way" is tiny. All I know is that it looks
ugly as Perl.
I would never do it this way. Not my style.
I would make a function that scans tags and gives out Emacs Lisp
structure, whatever it is.
Then anybody can do with the results whatever they want. We can then
make tags into helm or any other feature.
> My org-agenda-files contains files and I have a headline with the
> tag staff - no quotes, and the function's not returning anything.
Oh, you do have it?
-------------- don't abuse yourself by looking below
(defvar org--matcher-tags-todo-only nil)
(defun org-scan-tags (action matcher todo-only &optional start-level)
"Scan headline tags with inheritance and produce output ACTION.
ACTION can be `sparse-tree' to produce a sparse tree in the current buffer,
or `agenda' to produce an entry list for an agenda view. It can also be
a Lisp form or a function that should be called at each matched headline, in
this case the return value is a list of all return values from these calls.
MATCHER is a function accepting three arguments, returning
a non-nil value whenever a given set of tags qualifies a headline
for inclusion. See `org-make-tags-matcher' for more information.
As a special case, it can also be set to t (respectively nil) in
order to match all (respectively none) headline.
When TODO-ONLY is non-nil, only lines with a TODO keyword are
included in the output.
START-LEVEL can be a string with asterisks, reducing the scope to
headlines matching this string."
(require 'org-agenda)
(let* ((re (concat "^"
(if start-level
;; Get the correct level to match
(concat "\\*\\{" (number-to-string start-level) "\\} ")
org-outline-regexp)
" *\\(" (regexp-opt org-todo-keywords-1 'words) "\\)?"
" *\\(.*?\\)\\([ \t]:\\(?:" org-tag-re ":\\)+\\)?[ \t]*$"))
(props (list 'face 'default
'done-face 'org-agenda-done
'undone-face 'default
'mouse-face 'highlight
'org-not-done-regexp org-not-done-regexp
'org-todo-regexp org-todo-regexp
'org-complex-heading-regexp org-complex-heading-regexp
'help-echo
(format "mouse-2 or RET jump to Org file %S"
(abbreviate-file-name
(or (buffer-file-name (buffer-base-buffer))
(buffer-name (buffer-base-buffer)))))))
(org-map-continue-from nil)
lspos tags tags-list
(tags-alist (list (cons 0 org-file-tags)))
(llast 0) rtn rtn1 level category i txt
todo marker entry priority
ts-date ts-date-type ts-date-pair)
(unless (or (member action '(agenda sparse-tree)) (functionp action))
(setq action (list 'lambda nil action)))
(save-excursion
(goto-char (point-min))
(when (eq action 'sparse-tree)
(org-overview)
(org-remove-occur-highlights))
(while (let (case-fold-search)
(re-search-forward re nil t))
(setq org-map-continue-from nil)
(catch :skip
;; Ignore closing parts of inline tasks.
(when (and (fboundp 'org-inlinetask-end-p) (org-inlinetask-end-p))
(throw :skip t))
(setq todo (and (match-end 1) (match-string-no-properties 1)))
(setq tags (and (match-end 4) (org-trim (match-string-no-properties 4))))
(goto-char (setq lspos (match-beginning 0)))
(setq level (org-reduced-level (org-outline-level))
category (org-get-category))
(when (eq action 'agenda)
(setq ts-date-pair (org-agenda-entry-get-agenda-timestamp (point))
ts-date (car ts-date-pair)
ts-date-type (cdr ts-date-pair)))
(setq i llast llast level)
;; remove tag lists from same and sublevels
(while (>= i level)
(when (setq entry (assoc i tags-alist))
(setq tags-alist (delete entry tags-alist)))
(setq i (1- i)))
;; add the next tags
(when tags
(setq tags (org-split-string tags ":")
tags-alist
(cons (cons level tags) tags-alist)))
;; compile tags for current headline
(setq tags-list
(if org-use-tag-inheritance
(apply 'append (mapcar 'cdr (reverse tags-alist)))
tags)
org-scanner-tags tags-list)
(when org-use-tag-inheritance
(setcdr (car tags-alist)
(mapcar (lambda (x)
(setq x (copy-sequence x))
(org-add-prop-inherited x))
(cdar tags-alist))))
(when (and tags org-use-tag-inheritance
(or (not (eq t org-use-tag-inheritance))
org-tags-exclude-from-inheritance))
;; Selective inheritance, remove uninherited ones.
(setcdr (car tags-alist)
(org-remove-uninherited-tags (cdar tags-alist))))
(when (and
;; eval matcher only when the todo condition is OK
(and (or (not todo-only) (member todo org-todo-keywords-1))
(if (functionp matcher)
(let ((case-fold-search t) (org-trust-scanner-tags t))
(funcall matcher todo tags-list level))
matcher))
;; Call the skipper, but return t if it does not
;; skip, so that the `and' form continues evaluating.
(progn
(unless (eq action 'sparse-tree) (org-agenda-skip))
t)
;; Check if timestamps are deselecting this entry
(or (not todo-only)
(and (member todo org-todo-keywords-1)
(or (not org-agenda-tags-todo-honor-ignore-options)
(not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))))
;; select this headline
(cond
((eq action 'sparse-tree)
(and org-highlight-sparse-tree-matches
(org-get-heading) (match-end 0)
(org-highlight-new-match
(match-beginning 1) (match-end 1)))
(org-show-context 'tags-tree))
((eq action 'agenda)
(setq txt (org-agenda-format-item
""
(concat
(if (eq org-tags-match-list-sublevels 'indented)
(make-string (1- level) ?.) "")
(org-get-heading))
(make-string level ?\s)
category
tags-list)
priority (org-get-priority txt))
(goto-char lspos)
(setq marker (org-agenda-new-marker))
(org-add-props txt props
'org-marker marker 'org-hd-marker marker 'org-category category
'todo-state todo
'ts-date ts-date
'priority priority
'type (concat "tagsmatch" ts-date-type))
(push txt rtn))
((functionp action)
(setq org-map-continue-from nil)
(save-excursion
(setq rtn1 (funcall action))
(push rtn1 rtn)))
(t (user-error "Invalid action")))
;; if we are to skip sublevels, jump to end of subtree
(unless org-tags-match-list-sublevels
(org-end-of-subtree t)
(backward-char 1))))
;; Get the correct position from where to continue
(if org-map-continue-from
(goto-char org-map-continue-from)
(and (= (point) lspos) (end-of-line 1)))))
(when (and (eq action 'sparse-tree)
(not org-sparse-tree-open-archived-trees))
(org-hide-archived-subtrees (point-min) (point-max)))
(nreverse rtn)))
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 20:23 ` Nathan Neff
@ 2019-08-08 20:30 ` Jean Louis
2019-08-08 20:46 ` Nathan Neff
0 siblings, 1 reply; 13+ messages in thread
From: Jean Louis @ 2019-08-08 20:30 UTC (permalink / raw)
To: Nathan Neff; +Cc: emacs-orgmode
* Nathan Neff <nathan.neff@gmail.com> [2019-08-08 22:24]:
> I removed the staff from the beginning of the function call, and changed
> staff to bar I also removed the (or (and)) conditions :-)
>
> Now, I need to see how to make this function search all agenda files - it
> seems
> to work only on the headlines in Foo.org
I am glad that it works somehow for you.
I would not like that type of abuse on myself...
I would just do this:
M-x helm-occur
:staff
and it would be enough.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 20:30 ` Jean Louis
@ 2019-08-08 20:46 ` Nathan Neff
2019-08-08 21:20 ` Jean Louis
0 siblings, 1 reply; 13+ messages in thread
From: Nathan Neff @ 2019-08-08 20:46 UTC (permalink / raw)
To: Jean Louis; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]
Hi Jean Louis,
Thank you for your time and advice - I am trying to spend time
learning Elisp and more of the underpinnings in org-mode - so your
advice was very helpful.
In fact, I found that org-scan-tags is called by org-map-entries -
org-map-entries can specify a SCOPE of 'agenda (not the same
as the 'agenda that's provided to org-scan tags).
So, I got the code down to a one-liner!
;; This searches all agenda-files and returns a bunch of
;; stuff that I can re-use in Helm
(org-map-entries 'agenda "bkm" 'agenda)
As an aside:
When I run this in org-babel, it gives me a table with two cells:
| foo: Foo.org :bkm: | inbox:
Formatting Strings :bkm:emacs: |
Why doesn't this table have two *rows* instead of two *cells*?
If anyone knows the fix for this, I'd appreciate it. It probably has
something to do with the type
of data that's returned by the function, but I'll look into it later.
Thanks,
--Nate
Thanks for your help,
--Nate
On Thu, Aug 8, 2019 at 3:30 PM Jean Louis <bugs@gnu.support> wrote:
> * Nathan Neff <nathan.neff@gmail.com> [2019-08-08 22:24]:
> > I removed the staff from the beginning of the function call, and changed
> > staff to bar I also removed the (or (and)) conditions :-)
> >
> > Now, I need to see how to make this function search all agenda files - it
> > seems
> > to work only on the headlines in Foo.org
>
> I am glad that it works somehow for you.
>
> I would not like that type of abuse on myself...
>
> I would just do this:
>
> M-x helm-occur
>
> :staff
>
> and it would be enough.
>
[-- Attachment #2: Type: text/html, Size: 2535 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 20:46 ` Nathan Neff
@ 2019-08-08 21:20 ` Jean Louis
0 siblings, 0 replies; 13+ messages in thread
From: Jean Louis @ 2019-08-08 21:20 UTC (permalink / raw)
To: Nathan Neff; +Cc: emacs-orgmode
* Nathan Neff <nathan.neff@gmail.com> [2019-08-08 22:47]:
> Hi Jean Louis,
>
> Thank you for your time and advice - I am trying to spend time
> learning Elisp and more of the underpinnings in org-mode - so your
> advice was very helpful.
>
> In fact, I found that org-scan-tags is called by org-map-entries -
> org-map-entries can specify a SCOPE of 'agenda (not the same
> as the 'agenda that's provided to org-scan tags).
>
> So, I got the code down to a one-liner!
>
> ;; This searches all agenda-files and returns a bunch of
> ;; stuff that I can re-use in Helm
> (org-map-entries 'agenda bkm 'agenda)
Good if it works for you.
Me, I don't need much programming for Org. What I did for me is
sending assignments by email.
#+PROPERTY: ASSIGNED_ALL John
*** Policies on gold prospecting :staff:
:PROPERTIES:
:CREATED: [2019-05-11 Sat 11:14]
:ID: c9c92a1e-7f60-43b0-8dcf-c16ef47dca52
:ASSIGNED: John
:END:
Then if I execute the function, it asks me to send email with some
subject to Ezekiel, and he received the Org heading in the email.
That way I am distributing tasks to people who don't have computer,
they read it on phone and do it.
That is what I did with Org mode
(setq *rcd-org-members-for-assigned-tasks*
'((1 "John" "Management" "management@example.com" management)
;; Whereby "John" is in :ASSIGNED, then comes email identity, then comes
;; signature and settings for mutt. I use mutt to send auto emails from
;; Emacs.
(defun rcd-org-extract-assigned-member-email-data ()
"Fetches ASSIGNED individual from subtree and returns the data"
(let ((assigned (org-entry-get nil "ASSIGNED")))
(if (not assigned)
(let* ((individual (completing-read "Receiver:" (assigned-members-complete))))
(let ((id (rcd/org-find-assigned-member-id individual)))
(if id (rcd/org-find-assigned-member-email-data id)
nil)))
(let ((id (rcd/org-find-assigned-member-id assigned)))
(rcd/org-find-assigned-member-email-data id)))))
(defun rcd-org-subtree-to-file (signature)
"Saves subtree to file"
(org-back-to-heading)
(let* ((filename (concatenate 'string (getenv "TMPDIR") (rcd/file-timestamp) ".org")))
(org-copy-subtree)
(find-file-noselect filename)
(with-temp-file filename
(org-mode)
(yank)
(insert "\n\n")
(insert-file-contents signature)
)
filename))
(defun rcd/org-find-headline ()
"Finds current Org headline"
(org-with-wide-buffer
(org-back-to-heading t)
(let ((case-fold-search nil))
(when (looking-at org-complex-heading-regexp)
(match-string-no-properties 4)))))
(defun rcd-org-mutt-send-file (name email subject file &optional prefix)
"Uses mutt to quickly send the file"
(let* ((prefix (if prefix prefix (mutt/prepared-subject)))
(to (format "\"%s <%s>\"" name email))
;; (to (rcd-mutt-escape-string to))
(subject (concatenate 'string "\"" prefix ": " subject "\""))
(command (format "mutt -s %s -i \"%s\" %s" subject file to)))
(shell-command command)
(message command)))
(defun mutt/prepared-subject ()
(let ((subjects '("TASK" "UPDATED" "EXPENSES UPDATED"
"POLICY" "READ THIS" "PROJECT" "QUESTION"))
(completion-ignore-case t))
(completing-read "Choose subject: " subjects nil nil)))
(defun assigned-members-complete ()
(let ((list (loop for i in *rcd-org-members-for-assigned-tasks* collect (cons (second i) (second i)))))
list))
(defun rcd/org-send-assigned-task ()
"Sends assigned task to designated individual as Org"
(interactive)
(let* ((member-data (rcd-org-extract-assigned-member-email-data))
(id (if member-data (first member-data) nil))
(signature (if (equal (type-of (symbol-value (fifth member-data))) 'cons)
(third (symbol-value (fifth member-data))) ""))
(file (rcd-org-subtree-to-file signature))
(subject (rcd/org-find-headline))
(esubject (escape-% subject))
(ask (unless id (y-or-n-p "No assignment found. Do you want to send it by email?")))
(name (if id (third member-data)))
;; (name (if ask (read-from-minibuffer "Name:") name))
(voice (format "The task '%s' is being sent to '%s'" subject name))
(email (if id (if (equal (type-of (fourth member-data)) 'cons)
(car (fourth member-data))
(fourth member-data))))
(email (if ask (cf-search-email (read-from-minibuffer "Search for email: ")) email))
(really (y-or-n-p (format "Do you really want to send it to: %s?" (if ask email name)))))
(if (and really (or id ask))
(if (string-match "@" email)
(progn
;; (message (escape-% subject))
(speak voice)
(rcd-org-mutt-send-file name email esubject file))
(message "No email specified"))
(message "Aborted sending."))))
(global-set-key (kbd "C-x 7 o") 'rcd/org-send-assigned-task)
Some functions may be missing. But that is how I send tasks to my
people, it works well.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-08 16:49 Configure Helm Source from org-tags-view Nathan Neff
2019-08-08 19:00 ` Jean Louis
2019-08-08 19:13 ` Jean Louis
@ 2019-08-09 11:07 ` Adam Porter
2019-08-09 17:57 ` Nathan Neff
2 siblings, 1 reply; 13+ messages in thread
From: Adam Porter @ 2019-08-09 11:07 UTC (permalink / raw)
To: emacs-orgmode
Nathan Neff <nathan.neff@gmail.com> writes:
> Hello all,
>
> Has anyone created a Helm source from the results of org-agenda?
>
> Specifically org-tags-view I think would be a cool Helm source to
> configure where the headings that have certain tags could be displayed
> by Helm.
>
> I looked @ the code for org-tags-view and it's fairly straight forward - however, I think
> that the function itself is tightly coupled between finding the results and displaying the
> results. In other words, there's no "easy" function that I see which would provide headings
> that match a tags search that I could use as a Helm source.
>
> I think I would need to copy quite a bit of code from org-tags-view into a different
> function to create a Helm source. Am I missing something?
>
> Has anyone else done something similar?
That's what helm-org-rifle is for. For example, later in the thread you
mentioned searching for a "staff" tag. That would be very easy:
1. M-x helm-org-rifle-agenda-files RET (I have it bound to a key).
2. Type ":staff:".
3. See results.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-09 11:07 ` Adam Porter
@ 2019-08-09 17:57 ` Nathan Neff
2019-08-09 19:13 ` Adam Porter
0 siblings, 1 reply; 13+ messages in thread
From: Nathan Neff @ 2019-08-09 17:57 UTC (permalink / raw)
To: Adam Porter; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]
<whine>I know, but rifle has sooooo many dependencies</whine>
Rifle is truly awesome, I just have to convince myself to trust
f.el and d.el or whatever those one-letter libraries are :-)
Thanks,
--Nate
On Fri, Aug 9, 2019 at 6:10 AM Adam Porter <adam@alphapapa.net> wrote:
> Nathan Neff <nathan.neff@gmail.com> writes:
>
> > Hello all,
> >
> > Has anyone created a Helm source from the results of org-agenda?
> >
> > Specifically org-tags-view I think would be a cool Helm source to
> > configure where the headings that have certain tags could be displayed
> > by Helm.
> >
> > I looked @ the code for org-tags-view and it's fairly straight forward -
> however, I think
> > that the function itself is tightly coupled between finding the results
> and displaying the
> > results. In other words, there's no "easy" function that I see which
> would provide headings
> > that match a tags search that I could use as a Helm source.
> >
> > I think I would need to copy quite a bit of code from org-tags-view into
> a different
> > function to create a Helm source. Am I missing something?
> >
> > Has anyone else done something similar?
>
> That's what helm-org-rifle is for. For example, later in the thread you
> mentioned searching for a "staff" tag. That would be very easy:
>
> 1. M-x helm-org-rifle-agenda-files RET (I have it bound to a key).
> 2. Type ":staff:".
> 3. See results.
>
>
>
[-- Attachment #2: Type: text/html, Size: 2033 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-09 17:57 ` Nathan Neff
@ 2019-08-09 19:13 ` Adam Porter
2019-08-09 21:20 ` Nathan Neff
0 siblings, 1 reply; 13+ messages in thread
From: Adam Porter @ 2019-08-09 19:13 UTC (permalink / raw)
To: emacs-orgmode
Nathan Neff <nathan.neff@gmail.com> writes:
> <whine>I know, but rifle has sooooo many dependencies</whine>
>
> Rifle is truly awesome, I just have to convince myself to trust
> f.el and d.el or whatever those one-letter libraries are :-)
helm-org-rifle's dependencies are libraries which have been around for
over 6 years and are used by many thousands of people. The one-letter
names are because Emacs Lisp has no namespaces, and the convention is to
use package prefixes on all symbols, so long package names make for long
symbol names, which makes programming tedious.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Configure Helm Source from org-tags-view
2019-08-09 19:13 ` Adam Porter
@ 2019-08-09 21:20 ` Nathan Neff
0 siblings, 0 replies; 13+ messages in thread
From: Nathan Neff @ 2019-08-09 21:20 UTC (permalink / raw)
To: Adam Porter; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
On Fri, Aug 9, 2019 at 2:14 PM Adam Porter <adam@alphapapa.net> wrote:
> Nathan Neff <nathan.neff@gmail.com> writes:
>
> > <whine>I know, but rifle has sooooo many dependencies</whine>
> >
> > Rifle is truly awesome, I just have to convince myself to trust
> > f.el and d.el or whatever those one-letter libraries are :-)
>
> helm-org-rifle's dependencies are libraries which have been around for
> over 6 years and are used by many thousands of people. The one-letter
> names are because Emacs Lisp has no namespaces, and the convention is to
> use package prefixes on all symbols, so long package names make for long
> symbol names, which makes programming tedious.
>
This is good to know - I don't really have any rhyme/reason as to what
I use and don't use; For example, I use Helm which isn't part of default
Emacs.
Thanks again,
--Nate
[-- Attachment #2: Type: text/html, Size: 1375 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-08-09 21:20 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-08 16:49 Configure Helm Source from org-tags-view Nathan Neff
2019-08-08 19:00 ` Jean Louis
2019-08-08 19:13 ` Jean Louis
2019-08-08 20:03 ` Nathan Neff
2019-08-08 20:23 ` Nathan Neff
2019-08-08 20:30 ` Jean Louis
2019-08-08 20:46 ` Nathan Neff
2019-08-08 21:20 ` Jean Louis
2019-08-08 20:29 ` Jean Louis
2019-08-09 11:07 ` Adam Porter
2019-08-09 17:57 ` Nathan Neff
2019-08-09 19:13 ` Adam Porter
2019-08-09 21:20 ` Nathan Neff
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).