Browse Source

Merge branch 'km/from-emacs-master'

Kyle Meyer 4 years ago
parent
commit
8b9d6f67a0
6 changed files with 54 additions and 38 deletions
  1. 1 1
      etc/ORG-NEWS
  2. 9 0
      lisp/org-agenda.el
  3. 1 1
      lisp/org-element.el
  4. 24 34
      lisp/org-macs.el
  5. 2 2
      lisp/org.el
  6. 17 0
      lisp/ox-texinfo.el

+ 1 - 1
etc/ORG-NEWS

@@ -954,7 +954,7 @@ removed.
 For those who hate breaking changes, even though the changes are made
 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.
 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
 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
 **** New hooks
 Two hooks are added to org-attach:
 Two hooks are added to org-attach:

+ 9 - 0
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-cmd nil)
 (defvar org-agenda-overriding-arguments nil)
 (defvar org-agenda-overriding-arguments nil)
 (defvar org-agenda-overriding-cmd-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)
 (defun org-agenda-run-series (name series)
   "Run agenda NAME as a SERIES of agenda commands."
   "Run agenda NAME as a SERIES of agenda commands."
   (org-let (nth 1 series) '(org-agenda-prepare name))
   (org-let (nth 1 series) '(org-agenda-prepare name))

+ 1 - 1
lisp/org-element.el

@@ -4228,6 +4228,7 @@ looking into captions:
    (lambda (b)
    (lambda (b)
      (and (org-element-map b \\='latex-snippet #\\='identity nil t) b))
      (and (org-element-map b \\='latex-snippet #\\='identity nil t) b))
    nil nil nil t)"
    nil nil nil t)"
+  (declare (indent 2))
   ;; Ensure TYPES and NO-RECURSION are a list, even of one element.
   ;; Ensure TYPES and NO-RECURSION are a list, even of one element.
   (let* ((types (if (listp types) types (list types)))
   (let* ((types (if (listp types) types (list types)))
 	 (no-recursion (if (listp no-recursion) no-recursion
 	 (no-recursion (if (listp no-recursion) no-recursion
@@ -4321,7 +4322,6 @@ looking into captions:
 	(funcall --walk-tree data)
 	(funcall --walk-tree data)
 	;; Return value in a proper order.
 	;; Return value in a proper order.
 	(nreverse --acc)))))
 	(nreverse --acc)))))
-(put 'org-element-map 'lisp-indent-function 2)
 
 
 ;; The following functions are internal parts of the parser.
 ;; The following functions are internal parts of the parser.
 ;;
 ;;

+ 24 - 34
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))
   (let ((message-log-max nil))
     (apply #'message args)))
     (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)
 (defun org-eval (form)
   "Eval FORM and return result."
   "Eval FORM and return result."
   (condition-case error
   (condition-case error
-      (eval form)
+      (eval form t)
     (error (format "%%![Error: %s]" error))))
     (error (format "%%![Error: %s]" error))))
 
 
 (defvar org-outline-regexp) ; defined in org.el
 (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
 When ADDITIONAL-KEYS is not nil, also include SPC and DEL in the
 allowed keys for scrolling, as expected in the export dispatch
 allowed keys for scrolling, as expected in the export dispatch
 window."
 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)
 (provide 'org-macs)
 
 

+ 2 - 2
lisp/org.el

@@ -4767,8 +4767,8 @@ This is for getting out of special buffers like capture.")
 ;; Other stuff we need.
 ;; Other stuff we need.
 (require 'time-date)
 (require 'time-date)
 (unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
 (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-entities)
 (require 'org-faces)
 (require 'org-faces)

+ 17 - 0
lisp/ox-texinfo.el

@@ -1627,6 +1627,23 @@ Return output file's name."
     (org-export-to-file 'texinfo outfile
     (org-export-to-file 'texinfo outfile
       async subtreep visible-only body-only ext-plist)))
       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
 ;;;###autoload
 (defun org-texinfo-export-to-info
 (defun org-texinfo-export-to-info
   (&optional async subtreep visible-only body-only ext-plist)
   (&optional async subtreep visible-only body-only ext-plist)