diff --git a/README_maintainer b/README_maintainer index 04dc2c087..6b162aa52 100644 --- a/README_maintainer +++ b/README_maintainer @@ -2,6 +2,7 @@ #+TITLE: Org maintainer tasks #+STARTUP: noindent +#+OPTIONS: ^:nil This document describes the tasks the Org-mode maintainer has to do and how they are performed. diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 780d99f9c..1c71e0406 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -96,7 +96,7 @@ this variable.") (defun org-babel-expand-body:R (body params &optional graphics-file) "Expand BODY according to PARAMS, return the expanded body." (let ((graphics-file - (or graphics-file (org-babel-R-graphical-output-file params)))) + (or graphics-file (org-babel-graphical-output-file params)))) (mapconcat #'identity (append (when (cdr (assoc :prologue params)) @@ -117,7 +117,7 @@ This function is called by `org-babel-execute-src-block'." (cdr (assoc :session params)) params)) (colnames-p (cdr (assoc :colnames params))) (rownames-p (cdr (assoc :rownames params))) - (graphics-file (org-babel-R-graphical-output-file params)) + (graphics-file (org-babel-graphical-output-file params)) (full-body (let ((inside (list (org-babel-expand-body:R body params graphics-file)))) @@ -251,11 +251,6 @@ current code buffer." (process-name (get-buffer-process session))) (ess-make-buffer-current)) -(defun org-babel-R-graphical-output-file (params) - "Name of file to which R should send graphical output." - (and (member "graphics" (cdr (assq :result-params params))) - (cdr (assq :file params)))) - (defvar org-babel-R-graphics-devices '((:bmp "bmp" "filename") (:jpg "jpeg" "filename") diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 401e3f018..1348f04f5 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1591,7 +1591,7 @@ shown below. ;; row and column names (defun org-babel-del-hlines (table) "Remove all 'hlines from TABLE." - (remove 'hline table)) + (remq 'hline table)) (defun org-babel-get-colnames (table) "Return the column names of TABLE. @@ -2890,6 +2890,13 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'." (member (cdr pair) (cdr entry))) (t nil))))))) + +;;; Used by backends: R, Maxima, Octave. +(defun org-babel-graphical-output-file (params) + "File where a babel block should send graphical output, per PARAMS." + (and (member "graphics" (cdr (assq :result-params params))) + (cdr (assq :file params)))) + (provide 'ob-core) ;; Local variables: diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el index 7435f1d32..5d4ec18cc 100644 --- a/lisp/ob-maxima.el +++ b/lisp/ob-maxima.el @@ -52,7 +52,7 @@ (mapconcat 'identity (list ;; graphic output - (let ((graphic-file (org-babel-maxima-graphical-output-file params))) + (let ((graphic-file (org-babel-graphical-output-file params))) (if graphic-file (format "set_plot_option ([gnuplot_term, png]); set_plot_option ([gnuplot_out_file, %S]);" @@ -113,11 +113,6 @@ of the same value." (format "%S: %s$" var (org-babel-maxima-elisp-to-maxima val)))) -(defun org-babel-maxima-graphical-output-file (params) - "Name of file to which maxima should send graphical output." - (and (member "graphics" (cdr (assq :result-params params))) - (cdr (assq :file params)))) - (defun org-babel-maxima-elisp-to-maxima (val) "Return a string of maxima code which evaluates to VAL." (if (listp val) diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el index 8cc66b6f9..1e6102c89 100644 --- a/lisp/ob-octave.el +++ b/lisp/ob-octave.el @@ -84,16 +84,16 @@ end") body params (org-babel-variable-assignments:octave params))) (result (org-babel-octave-evaluate session - (if (org-babel-octave-graphical-output-file params) + (if (org-babel-graphical-output-file params) (mapconcat 'identity (list "set (0, \"defaultfigurevisible\", \"off\");" full-body - (format "print -dpng %s" (org-babel-octave-graphical-output-file params))) + (format "print -dpng %s" (org-babel-graphical-output-file params))) "\n") full-body) result-type matlabp))) - (if (org-babel-octave-graphical-output-file params) + (if (org-babel-graphical-output-file params) nil (org-babel-reassemble-table result @@ -268,11 +268,6 @@ This removes initial blank and comment lines and then calls (match-string 1 string) string)) -(defun org-babel-octave-graphical-output-file (params) - "Name of file to which maxima should send graphical output." - (and (member "graphics" (cdr (assq :result-params params))) - (cdr (assq :file params)))) - (provide 'ob-octave) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 937724351..c7f235deb 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -650,7 +650,7 @@ of custom agenda commands." :tag "Org Agenda Match View" :group 'org-agenda) (defgroup org-agenda-search-view nil - "Options concerning the general tags/property/todo match agenda view." + "Options concerning the search agenda view." :tag "Org Agenda Search View" :group 'org-agenda) @@ -3752,6 +3752,9 @@ generating a new one." (delete-dups (mapcar 'downcase (org-get-tags-at)))))))))) (run-hooks 'org-agenda-finalize-hook) + (when org-agenda-top-headline-filter + (org-agenda-filter-top-headline-apply + org-agenda-top-headline-filter)) (when org-agenda-tag-filter (org-agenda-filter-apply org-agenda-tag-filter 'tag)) (when (get 'org-agenda-tag-filter :preset-filter) diff --git a/lisp/org.el b/lisp/org.el index 93625e354..0d02f9fc3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5451,9 +5451,13 @@ The following commands are available: ;; Initialize cache. (org-element-cache-reset) ;; Beginning/end of defun - (org-set-local 'beginning-of-defun-function 'org-back-to-heading) + (org-set-local 'beginning-of-defun-function 'org-backward-element) (org-set-local 'end-of-defun-function - (lambda () (interactive) (org-end-of-subtree nil t))) + (lambda () + (if (not (org-at-heading-p)) + (org-forward-element) + (org-forward-element) + (forward-char -1)))) ;; Next error for sparse trees (org-set-local 'next-error-function 'org-occur-next-match) ;; Make sure dependence stuff works reliably, even for users who set it @@ -7740,7 +7744,7 @@ command." pos hide-previous previous-pos) ;; If we insert after content, move there and clean up whitespace - (when respect-content + (when (and respect-content (not (org-on-heading-p))) (org-end-of-subtree nil t) (skip-chars-backward " \r\n") (and (not (looking-back "^\\*+")) @@ -8589,11 +8593,11 @@ and still retain the repeater to cover future instances of the task." beg end template task idprop shift-n shift-what doshift nmin nmax) (if (not (and (integerp n) (> n 0))) - (error "Invalid number of replications %s" n)) + (user-error "Invalid number of replications %s" n)) (if (and (setq doshift (and (stringp shift) (string-match "\\S-" shift))) (not (string-match "\\`[ \t]*\\+?\\([0-9]+\\)\\([hdwmy]\\)[ \t]*\\'" shift))) - (error "Invalid shift specification %s" shift)) + (user-error "Invalid shift specification %s" shift)) (when doshift (setq shift-n (string-to-number (match-string 1 shift)) shift-what (cdr (assoc (match-string 2 shift) @@ -10627,7 +10631,7 @@ is used internally by `org-open-link-from-string'." (setq clean-buffer-list-kill-buffer-names (cons buf clean-buffer-list-kill-buffer-names)))) - (error "Abort")))) + (user-error "Abort")))) ((equal type "elisp") (let ((cmd path)) (if (or (and (org-string-nw-p @@ -10643,7 +10647,7 @@ is used internally by `org-open-link-from-string'." (if (eq (string-to-char cmd) ?\() (eval (read cmd)) (call-interactively (read cmd)))) - (error "Abort")))) + (user-error "Abort")))) ((equal type "id") (require 'ord-id) (funcall (nth 1 (assoc "id" org-link-protocols)) path)) @@ -10735,7 +10739,7 @@ there is one, return it." (message "Select link to open, RET to open all:") (setq c (read-char-exclusive)) (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) - (when (equal c ?q) (error "Abort")) + (when (equal c ?q) (user-error "Abort")) (if (equal c ?\C-m) (setq link links) (setq nth (- c ?0)) @@ -13036,7 +13040,7 @@ This function is run automatically after each state change to a DONE state." (time-to-days (current-time)))) (when (= (incf nshift) nshiftmax) (or (y-or-n-p (message "%d repeater intervals were not enough to shift date past today. Continue? " nshift)) - (error "Abort"))) + (user-error "Abort"))) (org-timestamp-change n (cdr (assoc what whata))) (org-at-timestamp-p t) (setq ts (match-string 1)) @@ -13720,7 +13724,7 @@ starting point when no match is found." (while (setq p1 (funcall search-func (point) 'org-type)) (when (equal p1 limit) (goto-char pos) - (error "No more matches")) + (user-error "No more matches")) (when (equal (get-char-property p1 'org-type) 'org-occur) (setq n (1- n)) (when (= n 0) @@ -13728,7 +13732,7 @@ starting point when no match is found." (throw 'exit (point)))) (goto-char p1)) (goto-char p1) - (error "No more matches")))) + (user-error "No more matches")))) (defun org-show-context (&optional key) "Make sure point and context are visible. @@ -18151,11 +18155,12 @@ Optional argument FILE means use this file instead of the current." ((equal r ?r) (org-remove-file file) (throw 'nextfile t)) - (t (error "Abort")))))) + (t (user-error "Abort")))))) (defun org-get-agenda-file-buffer (file) - "Get a buffer visiting FILE. If the buffer needs to be created, add -it to the list of buffers which might be released later." + "Get an agenda buffer visiting FILE. +If the buffer needs to be created, add it to the list of buffers +which might be released later." (let ((buf (org-find-base-buffer-visiting file))) (if buf buf ; just return it @@ -18577,7 +18582,7 @@ inspection." (buffer-substring-no-properties (region-beginning) (region-end))))) (read-string "LaTeX Fragment: " frag nil frag)))) - (unless latex-frag (error "Invalid LaTeX fragment")) + (unless latex-frag (user-error "Invalid LaTeX fragment")) (let* ((tmp-in-file (file-relative-name (make-temp-name (expand-file-name "ltxmathml-in")))) (ignore (write-region latex-frag nil tmp-in-file)) @@ -23011,7 +23016,7 @@ package ox-bibtex by Taru Karttunen." (if (not (save-excursion (or (re-search-forward re nil t) (re-search-backward re nil t)))) - (error "No bibliography defined in file") + (user-error "No bibliography defined in file") (setq bib (concat (match-string 1) ".bib") rds (list (list 'bib bib))))))) (call-interactively 'reftex-citation))) @@ -23604,7 +23609,8 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks." (if (looking-at re) (forward-char 1)) (condition-case nil (funcall re-search-fn re nil nil arg) - (error (error "No %s code blocks" (if backward "previous" "further" )))) + (error (user-error "No %s code blocks" + (if backward "previous" "further" )))) (goto-char (match-beginning 0)) (org-show-context))) (defun org-previous-block (arg &optional block-regexp) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 94d82c9d5..62bd48f74 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -454,6 +454,7 @@ export back-end currently used." (not org-html-use-infojs) (and (eq org-html-use-infojs 'when-configured) (or (not (plist-get exp-plist :infojs-opt)) + (string= "" (plist-get exp-plist :infojs-opt)) (string-match "\\" (plist-get exp-plist :infojs-opt))))) (let* ((template org-html-infojs-template) diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el index a60c2f92f..3571c4ce0 100644 --- a/lisp/ox-icalendar.el +++ b/lisp/ox-icalendar.el @@ -85,10 +85,11 @@ keyword." (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due) "Contexts where iCalendar export should use a deadline time stamp. -This is a list with several symbols in it. Valid symbol are: +This is a list with possibly several symbols in it. Valid symbols are: + `event-if-todo' Deadlines in TODO entries become calendar events. `event-if-not-todo' Deadlines in non-TODO entries become calendar events. -`todo-due' Use deadlines in TODO entries as due-dates" +`todo-due' Use deadlines in TODO entries as due-dates." :group 'org-export-icalendar :type '(set :greedy t (const :tag "Deadlines in non-TODO entries become events" @@ -101,7 +102,8 @@ This is a list with several symbols in it. Valid symbol are: (defcustom org-icalendar-use-scheduled '(todo-start) "Contexts where iCalendar export should use a scheduling time stamp. -This is a list with several symbols in it. Valid symbol are: +This is a list with possibly several symbols in it. Valid symbols are: + `event-if-todo' Scheduling time stamps in TODO entries become an event. `event-if-not-todo' Scheduling time stamps in non-TODO entries become an event. `todo-start' Scheduling time stamps in TODO entries become start date. diff --git a/lisp/ox.el b/lisp/ox.el index e90832337..8564b21a5 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -752,7 +752,7 @@ e.g. \"tasks:nil\"." (defcustom org-export-time-stamp-file t "Non-nil means insert a time stamp into the exported file. -The time stamp shows when the file was created. This option can +The time stamp shows when the file was created. This option can also be set with the OPTIONS keyword, e.g. \"timestamp:nil\"." :group 'org-export-general :type 'boolean) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 836b94bfa..069beb989 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -488,15 +488,12 @@ (org-test-with-temp-text "* H1\n Body" (org-insert-todo-heading-respect-content) (nth 2 (org-heading-components)))) - ;; Add headline after body of current subtree. + ;; Add headline at the end of the first subtree (should - (org-test-with-temp-text "* H1\nBody" + (org-test-with-temp-text "* H1\nH1Body\n** H2\nH2Body" + (search-forward "H1Body") (org-insert-todo-heading-respect-content) - (eobp))) - (should - (org-test-with-temp-text "* H1\n** H2\nBody" - (org-insert-todo-heading-respect-content) - (eobp))) + (and (eobp) (org-at-heading-p)))) ;; In a list, do not create a new item. (should (org-test-with-temp-text "* H\n- an item\n- another one"