From bff69f97f3a2850ab5c16e9b74bef79a3c119398 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 12 Mar 2014 11:57:38 +0100 Subject: [PATCH 1/6] org.el (org-contextualize-validate-key): Bugfix * org.el (org-contextualize-validate-key): Fix bug: perform the check even when (buffer-file-name) returns `nil'. --- lisp/org.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d7b08327e..0e36f60d6 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9130,9 +9130,10 @@ definitions." (string-match (cdr rr) (symbol-name major-mode))) (and (eq (car rr) 'in-buffer) (string-match (cdr rr) (buffer-name))) - (when (and (eq (car rr) 'not-in-file) + (if (and (eq (car rr) 'not-in-file) (buffer-file-name)) - (not (string-match (cdr rr) (buffer-file-name)))) + (not (string-match (cdr rr) (buffer-file-name))) + t) (when (eq (car rr) 'not-in-mode) (not (string-match (cdr rr) (symbol-name major-mode)))) (when (eq (car rr) 'not-in-buffer) From ccd1d1a19889fda0fd5c783fedb3e42ef1963701 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 12 Mar 2014 16:44:08 +0100 Subject: [PATCH 2/6] org-agenda.el (org-agenda-skip-subtree-if): Fix docstring * org-agenda.el (org-agenda-skip-subtree-if): Fix docstring. --- lisp/org-agenda.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a98ccba4c..a1c16a9aa 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4917,7 +4917,7 @@ See `org-agenda-skip-if' for details." (org-agenda-skip-if nil conditions)) (defun org-agenda-skip-subtree-if (&rest conditions) - "Skip entry if any of CONDITIONS is true. + "Skip subtree if any of CONDITIONS is true. See `org-agenda-skip-if' for details." (org-agenda-skip-if t conditions)) From 250abf061ba81c1d010c19d5f54506f10a37c1cb Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 12 Mar 2014 17:51:18 +0100 Subject: [PATCH 3/6] Bugfixes wrt inserting headings. * org.el (org-insert-heading): Fix regression: with two universal prefixes, insert heading at the end of the subtree. (org-insert-todo-heading): Bugfix: only enforce the first TODO state when arg is '(4). --- lisp/org.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 0e36f60d6..720600da5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7542,7 +7542,7 @@ This is important for non-interactive uses of the command." (let ((itemp (org-in-item-p)) (may-split (org-get-alist-option org-M-RET-may-split-line 'headline)) (respect-content (or org-insert-heading-respect-content - (equal arg '(16)))) + (equal arg '(4)))) (initial-content "") (adjust-empty-lines t)) @@ -7565,6 +7565,10 @@ This is important for non-interactive uses of the command." (org-insert-item)) (t + ;; Maybe move at the end of the subtree + (when (equal arg '(16)) + (org-up-heading-safe) + (org-end-of-subtree t)) ;; Insert a heading (save-restriction (widen) @@ -7759,8 +7763,8 @@ This is a list with the following elements: (defun org-insert-todo-heading (arg &optional force-heading) "Insert a new heading with the same level and TODO state as current heading. If the heading has no TODO state, or if the state is DONE, use the first -state (TODO by default). Also one prefix arg, force first state. With two -prefix args, force inserting at the end of the parent subtree." +state (TODO by default). Also with one prefix arg, force first state. With +two prefix args, force inserting at the end of the parent subtree." (interactive "P") (when (or force-heading (not (org-insert-item 'checkbox))) (org-insert-heading (or (and (equal arg '(16)) '(16)) @@ -7771,7 +7775,7 @@ prefix args, force inserting at the end of the parent subtree." (looking-at org-todo-line-regexp)) (let* ((new-mark-x - (if (or arg + (if (or (equal arg '(4)) (not (match-beginning 2)) (member (match-string 2) org-done-keywords)) (car org-todo-keywords-1) From b28ebdf3f17a0fa5ef42c1719951df989be6d910 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 12 Mar 2014 18:41:01 +0100 Subject: [PATCH 4/6] org.el (org-delete-property): Don't suggest to delete the CATEGORY property * org.el (org-delete-property): Don't suggest to delete the CATEGORY property when the category is not explicitely set in the property drawer. Also enforce matching when completing. Thanks to Oleh for providing a preliminary patch for this. --- lisp/org.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 720600da5..b6e00fac4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15805,13 +15805,16 @@ When optional argument DELETE-EMPTY-DRAWER is a string, it defines an empty drawer to delete." (interactive (let* ((completion-ignore-case t) - (prop (org-icompleting-read "Property: " - (org-entry-properties nil 'standard)))) + (cat (org-entry-get (point) "CATEGORY")) + (props0 (org-entry-properties nil 'standard)) + (props (if cat props0 + (delete `("CATEGORY" . ,(org-get-category)) props0))) + (prop (if (< 1 (length props)) + (org-icompleting-read "Property: " props nil t) + (caar props)))) (list prop))) - (message "Property %s %s" property - (if (org-entry-delete nil property delete-empty-drawer) - "deleted" - "was not present in the entry"))) + (if (org-entry-delete nil property delete-empty-drawer) + (message "Property %s deleted" property))) (defun org-delete-property-globally (property) "Remove PROPERTY globally, from all entries." From f0e5683a120fbd4acf722218e19022f13e7990c7 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 12 Mar 2014 18:56:24 +0100 Subject: [PATCH 5/6] org-src.el (org-edit-src-find-region-and-lang): Check if we are in a table.el table last * org-src.el (org-edit-src-find-region-and-lang): Check if we are in a table.el table last. Thanks to zwz and Thomas Holst for reporting this. --- lisp/org-src.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 6ded5e602..4ca123df5 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -577,14 +577,6 @@ the language, a switch telling if the content should be in a single line." (pos (point)) re1 re2 single beg end lang lfmt match-re1 ind entry) (catch 'exit - (when (org-at-table.el-p) - (re-search-backward "^[\t]*[^ \t|\\+]" nil t) - (setq beg (1+ (point-at-eol))) - (goto-char beg) - (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) - (progn (goto-char (point-max)) (newline))) - (setq end (1- (point-at-bol))) - (throw 'exit (list beg end 'table.el nil nil 0))) (while (setq entry (pop re-list)) (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) single (nth 3 entry)) @@ -615,7 +607,15 @@ the language, a switch telling if the content should be in a single line." (throw 'exit (list (match-end 0) end (org-edit-src-get-lang lang) - single lfmt ind)))))))))))) + single lfmt ind))))))))) + (when (org-at-table.el-p) + (re-search-backward "^[\t]*[^ \t|\\+]" nil t) + (setq beg (1+ (point-at-eol))) + (goto-char beg) + (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) + (progn (goto-char (point-max)) (newline))) + (setq end (1- (point-at-bol))) + (throw 'exit (list beg end 'table.el nil nil 0)))))) (defun org-edit-src-get-lang (lang) "Extract the src language." From 9323857411587db10b51621bc1fb5370e527866d Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Wed, 12 Mar 2014 19:08:17 +0100 Subject: [PATCH 6/6] org-src.el (org-edit-src-exit): Don't add indentation on empty lines * org-src.el (org-edit-src-exit): Don't add indentation on empty lines. TINYCHANGE --- lisp/org-src.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 4ca123df5..6f481e07a 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -737,8 +737,10 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." (unless (or single preserve-indentation (= total-nindent 0)) (setq indent (make-string total-nindent ?\ )) (goto-char (point-min)) - (while (re-search-forward "^" nil t) - (replace-match indent))) + (while (re-search-forward "^" nil t) + (if (not (looking-at "$")) + (replace-match indent) + (forward-char 1)))) (if (org-bound-and-true-p org-edit-src-picture) (setq total-nindent (+ total-nindent 2))) (setq code (buffer-string))