Re: [O] Recursive org-agenda-files
Hi Neilen, I think you want these in your .emacs (from http://orgmode.org/worg/org-faq.html, Can I add files recursively to my list of agenda files?): (load-library find-lisp) (setq org-agenda-files (find-lisp-find-files ~/org \.org$)) Or you can add each project directory to org-agenda-files yourself, however, this is not recursive, it only adds .org files under the project directories, not their sub-directories (see docstring of org-agenda-files: C-h v org-agenda-files): (setq org-agenda-files '(~/org/projA ~/org/projB ~/org/projC)) In my setup, I also use the following to exclude directory exc from the list: (eval-when-compile (require 'cl)) (setq org-agenda-files (remove-if '(lambda (x) (string-match (concat ^ (regexp-quote (expand-file-name ~/org/exc/))) x)) org-agenda-files)) Net On Mon, Oct 3, 2011 at 8:48 AM, Neilen Marais nmar...@gmail.com wrote: Hi, I like to have a directory per project, with an .org file in each directory. Is there a way to set org-agenda-files such that it can recursively scan my whole projects dir for all org files? Thanks Neilen
[O] Re-marking agenda entries, with advice on org-agenda-bulk-action in .emacs
Hello, The issue of re-marking agenda entries has been raised before: http://lists.gnu.org/archive/html/emacs-orgmode/2011-02/msg00200.html I am facing the same problem. I always do more than one bulk actions on the same set of agenda entries, so having to re-mark them manually has been a pain. The org-agenda-bulk-mark-regexp command sort of helped, but I still prefer the Dired behavior of retaining the mark after action is performed, (typing one 'U' is much less keystroke than any manual re-marking). Anyway, I put the following piece of code in .emacs to give me the Dired like behavior. It seems to work for me. Since I'm new to Emacs Lisp and this is the 2nd day I'm hacking Org-mode code, could anyone help spot anything I did stupid here that may shoot me in the foot? Much appreciated. (eval-after-load 'org-agenda '(defadvice org-agenda-bulk-action (around bulk-re-mark (optional arg) activate) Re-mark entries marked before action. (let ((entries (copy-sequence org-agenda-bulk-marked-entries))) ad-do-it (let (pos (cnt 0) (cntskip 0) (msg (current-message))) (dolist (e entries) (setq pos (text-property-any (point-min) (point-max) 'org-hd-marker e)) (if (not pos) (setq cntskip (1+ cntskip)) (goto-char pos) (call-interactively 'org-agenda-bulk-mark) (setq cnt (1+ cnt (message %s (%d entries re-marked, %d skipped) msg cnt cntskip) Cheers, Net P.S. I would like to express my sincere gratitude to all who helped make Org-mode such a beautiful piece of software and a life-changing experience.
Re: [O] % (org-agenda-bulk-mark-regexp) in agenda view problems
Sorry, didn't realized I wasn't sending email in plain text. On Sat, Oct 1, 2011 at 3:14 PM, netty hacky netty.ha...@gmail.com wrote: Hi Bastien, I found a third problem of org-agenda-bulk-mark-regexp, it does not work well on daily/weekly agenda view. Basically it chokes on lines that is not a regular headline, like date labels, dairy entries and grid lines. So to show I am not merely a leech on this list, I come up with my version here, most of the ugly code are to deal with the way org-agenda-bulk-mark works now (e.g., returning nil when successful): (defun org-agenda-bulk-mark-regexp (regexp) Mark entries match REGEXP. (interactive sMark entries matching regexp: ) (save-excursion (goto-char (point-min)) (let ((entries-marked 0)) (while (not (eobp)) (unless (and (not (get-char-property (point) 'invisible)) (not (org-get-at-bol 'org-agenda-diary-link)) (org-get-at-bol 'org-hd-marker) (let (txt-property) (setq txt-property (get-char-property (point) 'txt)) (string-match regexp txt-property)) (not (call-interactively 'org-agenda-bulk-mark)) (setq entries-marked (+ entries-marked 1))) (beginning-of-line 2))) (if (zerop entries-marked) (message No entry matching this regexp.) (message %d entries marked for bulk action entries-marked) Thanks, Net On Sat, Oct 1, 2011 at 12:38 AM, netty hacky netty.ha...@gmail.com wrote: Hi Bastien, I'm having two problems with the % command (org-agenda-bulk-mark-regexp) in Org-mode agenda view. 1. If I use . as the search string, I get Wrong type argument: number-or-marker-p, nil. And my workaround is to change the line (let (entries-marked) in org-agenda.el to (let ((entries-marked 0)). 2. If I use .* as the search string, I get Wrong type argument: stringp, nil. After some edebugging, I found the reason is that in org-agenda-bulk-mark-regexp, re-search-forward moved the point to the end of the line (since .* matches the whole line), causing (get-text-property (point) 'txt) to return nil, in turn caused string-match to throw the error. I think this may happen to other regexps, as long as the strings matched include the last character in the line. I'm new to Emacs Lisp so I'm not sure how to fix this one. Wondering why it seems only me having these two problems. I am using MacPorts' Emacs and Org-mode: Emacs : GNU Emacs 23.3.1 (x86_64-apple-darwin10.8.0) Package: Org-mode version 7.7 Thanks, Net
Re: [O] Re-marking agenda entries, with advice on org-agenda-bulk-action in .emacs
My bad, didn't realized I wasn't sending email in plain txt. On Sun, Oct 2, 2011 at 2:13 AM, netty hacky netty.ha...@gmail.com wrote: Hello, The issue of re-marking agenda entries has been raised before: http://lists.gnu.org/archive/html/emacs-orgmode/2011-02/msg00200.html I am facing the same problem. I always do more than one bulk actions on the same set of agenda entries, so having to re-mark them manually has been a pain. The org-agenda-bulk-mark-regexp command sort of helped, but I still prefer the Dired behavior of retaining the mark after action is performed, (typing one 'U' is much less keystroke than any manual re-marking). Anyway, I put the following piece of code in .emacs to give me the Dired like behavior. It seems to work for me. Since I'm new to Emacs Lisp and this is the 2nd day I'm hacking Org-mode code, could anyone help spot anything I did stupid here that may shoot me in the foot? Much appreciated. (eval-after-load 'org-agenda '(defadvice org-agenda-bulk-action (around bulk-re-mark (optional arg) activate) Re-mark entries marked before action. (let ((entries (copy-sequence org-agenda-bulk-marked-entries))) ad-do-it (let (pos (cnt 0) (cntskip 0) (msg (current-message))) (dolist (e entries) (setq pos (text-property-any (point-min) (point-max) 'org-hd-marker e)) (if (not pos) (setq cntskip (1+ cntskip)) (goto-char pos) (call-interactively 'org-agenda-bulk-mark) (setq cnt (1+ cnt (message %s (%d entries re-marked, %d skipped) msg cnt cntskip) Cheers, Net P.S. I would like to express my sincere gratitude to all who helped make Org-mode such a beautiful piece of software and a life-changing experience.
Re: [O] % (org-agenda-bulk-mark-regexp) in agenda view problems
Hi Bastien, I found a third problem of org-agenda-bulk-mark-regexp, it does not work well on daily/weekly agenda view. Basically it chokes on lines that is not a regular headline, like date labels, dairy entries and grid lines. So to show I am not merely a leech on this list, I come up with my version here, most of the ugly code are to deal with the way org-agenda-bulk-mark works now (e.g., returning nil when successful): (defun org-agenda-bulk-mark-regexp (regexp) Mark entries match REGEXP. (interactive sMark entries matching regexp: ) (save-excursion (goto-char (point-min)) (let ((entries-marked 0)) (while (not (eobp)) (unless (and (not (get-char-property (point) 'invisible)) (not (org-get-at-bol 'org-agenda-diary-link)) (org-get-at-bol 'org-hd-marker) (let (txt-property) (setq txt-property (get-char-property (point) 'txt)) (string-match regexp txt-property)) (not (call-interactively 'org-agenda-bulk-mark)) (setq entries-marked (+ entries-marked 1))) (beginning-of-line 2))) (if (zerop entries-marked) (message No entry matching this regexp.) (message %d entries marked for bulk action entries-marked) Thanks, Net On Sat, Oct 1, 2011 at 12:38 AM, netty hacky netty.ha...@gmail.com wrote: Hi Bastien, I'm having two problems with the % command (org-agenda-bulk-mark-regexp) in Org-mode agenda view. 1. If I use . as the search string, I get Wrong type argument: number-or-marker-p, nil. And my workaround is to change the line (let (entries-marked) in org-agenda.el to (let ((entries-marked 0)). 2. If I use .* as the search string, I get Wrong type argument: stringp, nil. After some edebugging, I found the reason is that in org-agenda-bulk-mark-regexp, re-search-forward moved the point to the end of the line (since .* matches the whole line), causing (get-text-property (point) 'txt) to return nil, in turn caused string-match to throw the error. I think this may happen to other regexps, as long as the strings matched include the last character in the line. I'm new to Emacs Lisp so I'm not sure how to fix this one. Wondering why it seems only me having these two problems. I am using MacPorts' Emacs and Org-mode: Emacs : GNU Emacs 23.3.1 (x86_64-apple-darwin10.8.0) Package: Org-mode version 7.7 Thanks, Net