branch: externals/org commit 8b9d6f67a083e22fe4fb2cadb2e21f1588e12bdc Merge: 63c5cac 7922d16 Author: Kyle Meyer <k...@kyleam.com> Commit: Kyle Meyer <k...@kyleam.com>
Merge branch 'km/from-emacs-master' --- etc/ORG-NEWS | 2 +- lisp/org-agenda.el | 9 +++++++++ lisp/org-element.el | 2 +- lisp/org-macs.el | 58 ++++++++++++++++++++++------------------------------- lisp/org.el | 4 ++-- lisp/ox-texinfo.el | 17 ++++++++++++++++ 6 files changed, 54 insertions(+), 38 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index f95a568..13c4179 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -954,7 +954,7 @@ removed. For those who hate breaking changes, even though the changes are made to clean things up; fear not. ATTACH_DIR will still continue to work. It's just not documented any longer. When you get the chance, run the -code above to clean things up anyways! +code above to clean things up anyway! **** New hooks Two hooks are added to org-attach: diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index bb026f7..ed976bf 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3240,6 +3240,15 @@ s Search for keywords M Like m, but only TODO entries (defvar org-agenda-overriding-cmd nil) (defvar org-agenda-overriding-arguments nil) (defvar org-agenda-overriding-cmd-arguments nil) + +(defun org-let (list &rest body) ;FIXME: So many kittens are suffering here. + (declare (indent 1)) + (eval (cons 'let (cons list body)))) + +(defun org-let2 (list1 list2 &rest body) ;FIXME: Where did our karma go? + (declare (indent 2)) + (eval (cons 'let (cons list1 (list (cons 'let (cons list2 body))))))) + (defun org-agenda-run-series (name series) "Run agenda NAME as a SERIES of agenda commands." (org-let (nth 1 series) '(org-agenda-prepare name)) diff --git a/lisp/org-element.el b/lisp/org-element.el index baccaba..5bac89e 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4228,6 +4228,7 @@ looking into captions: (lambda (b) (and (org-element-map b \\='latex-snippet #\\='identity nil t) b)) nil nil nil t)" + (declare (indent 2)) ;; Ensure TYPES and NO-RECURSION are a list, even of one element. (let* ((types (if (listp types) types (list types))) (no-recursion (if (listp no-recursion) no-recursion @@ -4321,7 +4322,6 @@ looking into captions: (funcall --walk-tree data) ;; Return value in a proper order. (nreverse --acc))))) -(put 'org-element-map 'lisp-indent-function 2) ;; The following functions are internal parts of the parser. ;; diff --git a/lisp/org-macs.el b/lisp/org-macs.el index d40ed1a..8fa523e 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -627,18 +627,10 @@ program is needed for, so that the error message can be more informative." (let ((message-log-max nil)) (apply #'message args))) -(defun org-let (list &rest body) - (eval (cons 'let (cons list body)))) -(put 'org-let 'lisp-indent-function 1) - -(defun org-let2 (list1 list2 &rest body) - (eval (cons 'let (cons list1 (list (cons 'let (cons list2 body))))))) -(put 'org-let2 'lisp-indent-function 2) - (defun org-eval (form) "Eval FORM and return result." (condition-case error - (eval form) + (eval form t) (error (format "%%![Error: %s]" error)))) (defvar org-outline-regexp) ; defined in org.el @@ -1242,31 +1234,29 @@ Return 0. if S is not recognized as a valid value." When ADDITIONAL-KEYS is not nil, also include SPC and DEL in the allowed keys for scrolling, as expected in the export dispatch window." - (let ((scrlup (if additional-keys '(?\s 22) 22)) - (scrldn (if additional-keys `(?\d 134217846) 134217846))) - (eval - `(cl-case ,key - ;; C-n - (14 (if (not (pos-visible-in-window-p (point-max))) - (ignore-errors (scroll-up 1)) - (message "End of buffer") - (sit-for 1))) - ;; C-p - (16 (if (not (pos-visible-in-window-p (point-min))) - (ignore-errors (scroll-down 1)) - (message "Beginning of buffer") - (sit-for 1))) - ;; SPC or - (,scrlup - (if (not (pos-visible-in-window-p (point-max))) - (scroll-up nil) - (message "End of buffer") - (sit-for 1))) - ;; DEL - (,scrldn (if (not (pos-visible-in-window-p (point-min))) - (scroll-down nil) - (message "Beginning of buffer") - (sit-for 1))))))) + (let ((scrlup (if additional-keys '(?\s ?\C-v) ?\C-v)) + (scrldn (if additional-keys `(?\d ?\M-v) ?\M-v))) + (pcase key + (?\C-n (if (not (pos-visible-in-window-p (point-max))) + (ignore-errors (scroll-up 1)) + (message "End of buffer") + (sit-for 1))) + (?\C-p (if (not (pos-visible-in-window-p (point-min))) + (ignore-errors (scroll-down 1)) + (message "Beginning of buffer") + (sit-for 1))) + ;; SPC or + ((guard (memq key scrlup)) + (if (not (pos-visible-in-window-p (point-max))) + (scroll-up nil) + (message "End of buffer") + (sit-for 1))) + ;; DEL + ((guard (memq key scrldn)) + (if (not (pos-visible-in-window-p (point-min))) + (scroll-down nil) + (message "Beginning of buffer") + (sit-for 1)))))) (provide 'org-macs) diff --git a/lisp/org.el b/lisp/org.el index 0059656..1e60f60 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4767,8 +4767,8 @@ This is for getting out of special buffers like capture.") ;; Other stuff we need. (require 'time-date) (unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time)) -(require 'easymenu) -(require 'overlay) +(when (< emacs-major-version 28) ; preloaded in Emacs 28 + (require 'easymenu)) (require 'org-entities) (require 'org-faces) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index cf08054..78d58be 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -1627,6 +1627,23 @@ Return output file's name." (org-export-to-file 'texinfo outfile async subtreep visible-only body-only ext-plist))) +(defun org-texinfo-export-to-texinfo-batch () + "Export Org file INFILE to Texinfo file OUTFILE, in batch mode. +Usage: emacs -batch -f org-texinfo-export-to-texinfo-batch INFILE OUTFILE" + (or noninteractive (user-error "Batch mode use only")) + (let ((infile (pop command-line-args-left)) + (outfile (pop command-line-args-left)) + (org-export-coding-system org-texinfo-coding-system)) + (unless (file-readable-p infile) + (message "File `%s' not readable" infile) + (kill-emacs 1)) + (when (file-exists-p outfile) + (message "File `%s' already exists" outfile) + (kill-emacs 1)) + (with-temp-buffer + (insert-file-contents infile) + (org-export-to-file 'texinfo outfile)))) + ;;;###autoload (defun org-texinfo-export-to-info (&optional async subtreep visible-only body-only ext-plist)