[O] Completely hide the :PROPERTIES: drawer in org-mode.
A few years ago, I wrote up an answer to my own question on Stackoverflow to completely hide the :PROPERTIES: drawer, including the line that says :PROPERTIES:. Since then, it has received nearly 5,000 views, 11 stars, 17 upvotes on the initial question, and 15 upvotes on the answer. Today, a forum participant posted a comment underneath my answer asking why not send this upstream. So, here is the link to the answer: https://stackoverflow.com/a/17492723/2112489 Thanks, Keith
[O] org-agenda-highlight-todo may erroneously pickup icon 'display property.
Depending upon a user's `org-agenda-prefix-format` (e.g., "%i %-10:c% t%s"), `org-agenda-highlight-todo` may erroneously pickup an icon `'display` property and then include/duplicate that icon in a new space between the todo-keyword and the priority. I chose tho fix this in my own setup with `org-plist-delete` to remove the `'display` pair of PROPERTY / VALUE from the plist of text properties that are copied to the new space " " that is concatenated between the todo-keyword and the priority. Thanks, Keith
[O] `org-agenda-sorting-strategy` -- missing text properties.
There are nine (9) places in org-version 8.2.10 (which is included within Emacs public release 24.5.1) that could use some attention by the org-mode team. I have fixed it in my own custom version of org-mode, but I have seen a couple of questions recently on the Emacs forums by users wondering why the sorting strategy does not always work in various situations. The reason why users are having problems is because not all of the text properties are added during the data gathering process that are needed for `org-entries-lessp` to do its job. I would suggest that the org-mode team look at all nine (9) locations where `org-add-props txt props` is used and try to add as many additional text properties as possible for members of the `org-agenda-sorting-strategy`. Of course, the org-mode team will need to make decisions and code will need to be added to gather/assign the applicable values before the text-properties can be assigned. In a nutshell, if the `org-agenda-sorting-strategy` of fers a sorting type, then an effort should be made within the code to assign those corresponding text properties when the data is gathered. Decisions by the org-mode team, include, but are not limited to, which timestamp will be used for a sorting date when both deadline and scheduled are present -- perhaps even a new sorting thing-a-ma-jig to deal with that special situation should be created. Thanks, Keith
[O] `invalid face reference nil` caused by `org-agenda-fontify-properties`
I had a little free time today and was finally able to track down the invalid face reference when generating an org-agenda buffer. It is caused because the `car` of the `cons` cell created by `org-agenda-fontify-properties` is sometimes `nil`. I threw in `bold` as a catch-all and the error is gone. On a different note, the help mode buffer (C-u C-x =) doesn't seem to be able to follow the link of the cons cell to the face in the source code -- this should also be fixed (but I don't have a solution for that today). (defun org-agenda-fontify-priorities () Make highest priority lines bold, and lowest italic. (interactive) (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-priority) (delete-overlay o))) (overlays-in (point-min) (point-max))) (save-excursion (let (b e p ov h l) (goto-char (point-min)) (while (re-search-forward \\[#\\(.\\)\\] nil t) (setq h (or (get-char-property (point) 'org-highest-priority) org-highest-priority) l (or (get-char-property (point) 'org-lowest-priority) org-lowest-priority) p (string-to-char (match-string 1)) b (match-beginning 0) e (if (eq org-agenda-fontify-priorities 'cookies) (match-end 0) (point-at-eol)) ov (make-overlay b e)) (overlay-put ov 'face (cons (cond ((org-face-from-face-or-color 'priority nil (cdr (assoc p org-priority-faces ((and (listp org-agenda-fontify-priorities) (org-face-from-face-or-color 'priority nil (cdr (assoc p org-agenda-fontify-priorities) ((equal p l) 'italic) ((equal p h) 'bold) (t 'bold)) ;; Here is a temporary fix! 'org-priority)) (overlay-put ov 'org-type 'org-priority) Thanks, Keith ;;; Emacs : GNU Emacs 25.0.50.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549)) of 2014-10-01 on MP.local Package: Org-mode version 8.2.6 (release_8.2.6-1 @ /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/org/) current state: == (setq org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook) org-occur-hook '(org-first-headline-recenter) org-metaup-hook '(org-babel-load-in-session-maybe) org-confirm-shell-link-function 'yes-or-no-p org-startup-folded nil org-support-shift-select 'always org-agenda-custom-commands '((1 Events agenda excludes: * Active | * Next Action ((org-agenda-span (quote month)) (org-agenda-time-grid nil) (org-agenda-outline-show-all-dates nil) (org-agenda-entry-types (quote (:deadline))) (org-agenda-skip-function (quote (org-agenda-skip-entry-if (quote regexp) \\* Active\\|\\* Next Action) ) ) (org-deadline-warning-days 0)) ) (2 TODAY: Events (week) + Tasks (day) + Undated (all) ((agenda Events ((org-agenda-span (quote week) )
[O] bug#16265: 24.3.50; re-search-forward (error Invalid search bound (wrong side of point))
Yes, the issue has indeed been resolved in the latest version of Emacs Trunk that I built today. I used my example to conduct the test, and it works now with `cache-long-scans` enabled. Great job -- thank you Eli, and thanks again Nicolas! Keith ;;; At Wed, 01 Jan 2014 19:50:12 +0200, Eli Zaretskii wrote: Date: Tue, 31 Dec 2013 09:37:15 -0800 From: Keith David Bershatsky e...@lawlist.com Cc: 16...@debbugs.gnu.org So my recommendation would be that the Emacs team return the default value of `cache-long-scans` to `nil` Unlikely to happen. or, fix it somehow so that it doesn't interfere with popular functions like `re-search-forward` and `re-search-backward` after calling `org-capture`. I think I fixed this in trunk revision 115826, please try the latest version of the code. (I only verified that the simplified test case works after the fix.) Thanks.
[O] bug#16265: 24.3.50; re-search-forward (error Invalid search bound (wrong side of point))
Nicolas: Yes, `(setq-default cache-long-scans nil)` does indeed fix the problem. In a version of Emacs Trunk built on October 5, 2013, the default value for `cache-long-scans` is `nil`. In the recent version of Emacs Trunk built on December 23, 2013, the default value for `cache-long-scans` is `t`. I would suspect that anyone who uses `org-capture` will have significant problems performing various operations on the `org-agenda-files` subsequent to the initial call. So my recommendation would be that the Emacs team return the default value of `cache-long-scans` to `nil`; or, fix it somehow so that it doesn't interfere with popular functions like `re-search-forward` and `re-search-backward` after calling `org-capture`. Thank you very much for your hard work tracking down the issue. Keith ;;; At Tue, 31 Dec 2013 15:16:40 +0100, Nicolas Richard wrote: Nicolas Richard theonewiththeevill...@yahoo.fr writes: I'll bisect this (I tested 24.3, it works there) and post the result bisection is done. # first bad commit: [f56f1e3993fd79240e03666cf8390f489b4a2435] Switch cache-long-scans to t by default. and indeed, running emacs -Q --batch --eval '(setq-default cache-long-scans nil)' -l filenamehere worked for me. Keith, can you test if it fixes the problems your are seeing as well ? (If it doesn't then I guess we'll need another bug report.) If it does, the next step is to understand why things break when the caching mechanism is enabled -- I give up there. -- Nico.
[O] bug#16265: 24.3.50; re-search-forward (error Invalid search bound (wrong side of point))
Nicolas: This example demonstrates the problem caused when `org-capture` damages the line numbers in the `org-agenda-files`, making it impossible to go to the bottom of the buffer with (goto-char (point-max)) -- consequently, re-search-backward fails -- other functions fail also, e.g., `org-sort-entries`. (defun example () (interactive) (let* ( (org-todo-keywords '((sequence Active(a) Next Action(n) Reference(r) Someday(s) Delegated(d) | None(N)) )) (sample-todo (concat * TASKS\n\n ** Active [#A] smith @ drawer-one (fishing) | drawer-two (tennis). :lawlist:\n DEADLINE: 2013-12-21 Sat 17:00 SCHEDULED: 2013-12-21 Sat\n :PROPERTIES:\n :DRAWER-ONE: fishing\n :DRAWER-TWO: tennis\n :END:\n\n ** Next-Action [#B] doe @ drawer-one (football) | drawer-two (bowling). :fred:\n DEADLINE: 2013-12-22 Sun 08:30 SCHEDULED: 2013-12-22 Sun\n :PROPERTIES:\n :DRAWER-ONE: football\n :DRAWER-TWO: bowling\n :END:\n\n * EVENTS\n\n ** Reference [#C] john @ drawer-one (fishing) | drawer-two (sky-diving). :george:\n DEADLINE: 2013-12-23 Mon 10:15 SCHEDULED: 2013-12-23 Mon\n :PROPERTIES:\n :DRAWER-ONE: fishing\n :DRAWER-TWO: sky-diving\n :END:\n\n * UNDATED\n\n ** Someday [#D] jane @ drawer-one (basket-ball) | drawer-two (bowling). :sam:\n DEADLINE: 2013-12-24 Tues 12:00 SCHEDULED: 2013-12-24 Tues\n :PROPERTIES:\n :DRAWER-ONE: basket-ball\n :DRAWER-TWO: bowling\n :END:))) (if (get-buffer foo.org) (progn (switch-to-buffer foo.org) (erase-buffer) (delete-other-windows)) (switch-to-buffer (get-buffer-create foo.org))) (org-mode) (linum-mode 1) (insert sample-todo) (goto-char (point-min)) (or (y-or-n-p (format For this example work, you must save this buffer as a file. Proceed with example?)) (error Canceled.)) (write-file ~/Desktop/foo.org t) (let* ( (filename (buffer-file-name)) (org-agenda-files (list filename)) (org-capture-templates '((n Next Action entry (file+headline filename TASKS) ** Next Action [#A] %?\n DEADLINE: %%Y-%m-%d %a\n :PROPERTIES:\n :ToodledoID:\n :ToodledoFolder: TASKS\n :Hash:\n :END: :empty-lines 1 (search-backward-example) (org-capture nil n) (message -) (message Here we can see that the line numbers in 'foo.org' got messed up.) (sit-for 5) (insert Hello World! :lawlist:) (org-capture-finalize) (search-backward-example) (message -) (message Here is where things really went wrong. It's searching the WRONG todo.) (message -) (switch-to-buffer *Messages* (defun search-backward-example () (require 'org-element) (let* (element todo-state title deadline scheduled day month year (org-todo-keywords '((sequence Active(a) Next Action(n) Reference(r) Someday(s) Delegated(d) | None(N)) ))) (goto-char (point-max)) (while (re-search-backward ^\*\* \\(Reference\\) nil t) (setq element (org-element-at-point)) (setq todo-state (org-element-property :todo-keyword element)) (setq title (org-element-property :title element)) (setq deadline (ignore-errors (org-element-property :deadline element) )) (setq scheduled (ignore-errors (org-element-property :scheduled element) )) (setq day (ignore-errors (org-element-property :day-start scheduled))) (setq month (ignore-errors (org-element-property :month-start scheduled))) (setq year (ignore-errors (org-element-property :year-start scheduled))) (message -) (message todo-state: %s todo-state) (message deadline: %s deadline) (message scheduled: %s scheduled) (message title: %s title) (message day: %s day) (message month: %s month) (message year: %s year) (message -) )))
[O] Fwd: property drawer search -- org-element-headline-parser
Between the version 7.9.3f and 8.2.3a, the org team changed the property drawer from lowercase to capital letters for the org-element-headline-parser -- this resulted in several hours of lost time tracking down the issue. The issue is now resolved -- I hope there was a good reason for changing it. Keith --- Begin forwarded message: From: Keith David Bershatsky e...@lawlist.com Date: December 23, 2013 6:46:57 PM PST To: emacs-orgmode@gnu.org Subject: property drawer search -- org-element-headline-parser The property drawer search (which was working with Org version 7.9.3f) is no longer working with Org version 8.2.3a. The following 'example' function works correctly when using the prior version of org-element-headline-parser. Emacs Trunk (built today) comes with Org version 8.2.3a. (require 'org) (require 'org-element) (defun example () For this example to work, it will need to create a file -- 'org-agenda-files' You may adjust the location of the file. The file will not be deleted automatically. (interactive) (let ((sample-todo (concat ** Active [#A] smith @ drawer-one (fishing) | drawer-two (tennis). :lawlist:\n DEADLINE: 2013-12-21 Sat 17:00 SCHEDULED: 2013-12-21 Sat\n :PROPERTIES:\n :DRAWER-ONE: fishing\n :DRAWER-TWO: tennis\n :END:\n\n ** Next-Action [#B] doe @ drawer-one (football) | drawer-two (bowling). :fred:\n DEADLINE: 2013-12-22 Sun 08:30 SCHEDULED: 2013-12-22 Sun\n :PROPERTIES:\n :DRAWER-ONE: football\n :DRAWER-TWO: bowling\n :END:\n\n ** Reference [#C] john @ drawer-one (fishing) | drawer-two (sky-diving). :george:\n DEADLINE: 2013-12-23 Mon 10:15 SCHEDULED: 2013-12-23 Mon\n :PROPERTIES:\n :DRAWER-ONE: fishing\n :DRAWER-TWO: sky-diving\n :END:\n\n ** Someday [#D] jane @ drawer-one (basket-ball) | drawer-two (bowling). :sam:\n DEADLINE: 2013-12-24 Tues 12:00 SCHEDULED: 2013-12-24 Tues\n :PROPERTIES:\n :DRAWER-ONE: basket-ball\n :DRAWER-TWO: bowling\n :END:))) (if (get-buffer foo.org) (progn (switch-to-buffer foo.org) (erase-buffer) (delete-other-windows)) (switch-to-buffer (get-buffer-create foo.org))) (org-mode) (insert sample-todo) (goto-char (point-min)) (or (y-or-n-p (format For this example work, you must save this buffer as a file. Proceed with example?)) (error Canceled.)) (write-file ~/Desktop/foo.org t) (let* ( (display-buffer-alist nil) ;; lawlist custom setting (filename (buffer-file-name)) (org-agenda-files (list filename)) (org-agenda-only-exact-dates t) (org-agenda-show-all-dates nil) (org-deadline-warning-days 0) (org-agenda-time-grid nil) (org-agenda-span 'month) (org-agenda-entry-types '(:deadline)) (month 12) (year 2013) (org-agenda-start-day (concat year - month - 01)) (drawer-content (read-string basket-ball | bowling | fishing | football | sky-diving | tennis: nil)) (org-agenda-skip-function (lambda () (org-back-to-heading t) (let* ( (element (org-element-at-point)) (drawer-one (org-element-property :drawer-one element)) (drawer-two (org-element-property :drawer-two element))) (cond ((not (or (equal drawer-one drawer-content) (equal drawer-two drawer-content))) (message drawer-one: %s drawer-one) (message drawer-two: %s drawer-two) (org-end-of-subtree t)) (t nil) )) ))) (org-agenda-list)) )) (defalias 'org-element-headline-parser 'lawlist-org-element-headline-parser) (defun lawlist-org-element-headline-parser (limit optional raw-secondary-p) Parse an headline. Return a list whose CAR is `headline' and CDR is a plist containing `:raw-value', `:title', `:begin', `:end', `:pre-blank', `:hiddenp', `:contents-begin' and `:contents-end', `:level', `:priority', `:tags', `:todo-keyword',`:todo-type', `:scheduled', `:deadline', `:timestamp', `:clock', `:category', `:quotedp', `:archivedp', `:commentedp' and `:footnote-section-p' keywords. The plist also contains any property set in the property drawer, with its name in lowercase, the underscores replaced with hyphens and colons at the beginning (i.e. `:custom-id'). When RAW-SECONDARY-P is non-nil, headline's title will not be parsed as a secondary string, but as a plain string instead. Assume point is at beginning of the headline. (save-excursion (let* ((components (org-heading-components
[O] property drawer search -- org-element-headline-parser
The property drawer search (which was working with Org version 7.9.3f) is no longer working with Org version 8.2.3a. The following 'example' function works correctly when using the prior version of org-element-headline-parser. Emacs Trunk (built today) comes with Org version 8.2.3a. (require 'org) (require 'org-element) (defun example () For this example to work, it will need to create a file -- 'org-agenda-files' You may adjust the location of the file. The file will not be deleted automatically. (interactive) (let ((sample-todo (concat ** Active [#A] smith @ drawer-one (fishing) | drawer-two (tennis). :lawlist:\n DEADLINE: 2013-12-21 Sat 17:00 SCHEDULED: 2013-12-21 Sat\n :PROPERTIES:\n :DRAWER-ONE: fishing\n :DRAWER-TWO: tennis\n :END:\n\n ** Next-Action [#B] doe @ drawer-one (football) | drawer-two (bowling). :fred:\n DEADLINE: 2013-12-22 Sun 08:30 SCHEDULED: 2013-12-22 Sun\n :PROPERTIES:\n :DRAWER-ONE: football\n :DRAWER-TWO: bowling\n :END:\n\n ** Reference [#C] john @ drawer-one (fishing) | drawer-two (sky-diving). :george:\n DEADLINE: 2013-12-23 Mon 10:15 SCHEDULED: 2013-12-23 Mon\n :PROPERTIES:\n :DRAWER-ONE: fishing\n :DRAWER-TWO: sky-diving\n :END:\n\n ** Someday [#D] jane @ drawer-one (basket-ball) | drawer-two (bowling). :sam:\n DEADLINE: 2013-12-24 Tues 12:00 SCHEDULED: 2013-12-24 Tues\n :PROPERTIES:\n :DRAWER-ONE: basket-ball\n :DRAWER-TWO: bowling\n :END:))) (if (get-buffer foo.org) (progn (switch-to-buffer foo.org) (erase-buffer) (delete-other-windows)) (switch-to-buffer (get-buffer-create foo.org))) (org-mode) (insert sample-todo) (goto-char (point-min)) (or (y-or-n-p (format For this example work, you must save this buffer as a file. Proceed with example?)) (error Canceled.)) (write-file ~/Desktop/foo.org t) (let* ( (display-buffer-alist nil) ;; lawlist custom setting (filename (buffer-file-name)) (org-agenda-files (list filename)) (org-agenda-only-exact-dates t) (org-agenda-show-all-dates nil) (org-deadline-warning-days 0) (org-agenda-time-grid nil) (org-agenda-span 'month) (org-agenda-entry-types '(:deadline)) (month 12) (year 2013) (org-agenda-start-day (concat year - month - 01)) (drawer-content (read-string basket-ball | bowling | fishing | football | sky-diving | tennis: nil)) (org-agenda-skip-function (lambda () (org-back-to-heading t) (let* ( (element (org-element-at-point)) (drawer-one (org-element-property :drawer-one element)) (drawer-two (org-element-property :drawer-two element))) (cond ((not (or (equal drawer-one drawer-content) (equal drawer-two drawer-content))) (message drawer-one: %s drawer-one) (message drawer-two: %s drawer-two) (org-end-of-subtree t)) (t nil) )) ))) (org-agenda-list)) )) (defalias 'org-element-headline-parser 'lawlist-org-element-headline-parser) (defun lawlist-org-element-headline-parser (limit optional raw-secondary-p) Parse an headline. Return a list whose CAR is `headline' and CDR is a plist containing `:raw-value', `:title', `:begin', `:end', `:pre-blank', `:hiddenp', `:contents-begin' and `:contents-end', `:level', `:priority', `:tags', `:todo-keyword',`:todo-type', `:scheduled', `:deadline', `:timestamp', `:clock', `:category', `:quotedp', `:archivedp', `:commentedp' and `:footnote-section-p' keywords. The plist also contains any property set in the property drawer, with its name in lowercase, the underscores replaced with hyphens and colons at the beginning (i.e. `:custom-id'). When RAW-SECONDARY-P is non-nil, headline's title will not be parsed as a secondary string, but as a plain string instead. Assume point is at beginning of the headline. (save-excursion (let* ((components (org-heading-components)) (level (nth 1 components)) (todo (nth 2 components)) (todo-type (and todo (if (member todo org-done-keywords) 'done 'todo))) (tags (let ((raw-tags (nth 5 components))) (and raw-tags (org-split-string raw-tags : (raw-value (or (nth 4 components) )) (quotedp (let ((case-fold-search nil)) (string-match (format ^%s\\( \\|$\\) org-quote-string) raw-value))) (commentedp (let ((case-fold-search nil)) (string-match