]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert "Set org-macro-templates more lazily"
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 4 Mar 2024 03:09:19 +0000 (22:09 -0500)
committerEshel Yaron <me@eshelyaron.com>
Tue, 5 Mar 2024 15:11:19 +0000 (16:11 +0100)
This reverts commit 99483e214fdafa76e8001c7009dff13a76c33f32.

(cherry picked from commit 1a37fe3a66930bb8151a29c722dbe3bebc20d033)

lisp/org/org-macro.el
lisp/org/org-macs.el
lisp/org/org.el

index acc8f5e593bd548c117fe575e1e0ad09812d3ba3..737eab5d2bb812a2d46a6013fdacbe1757c84827 100644 (file)
 
 ;;; Variables
 
-(defvar-local org-macro-templates t
+(defvar-local org-macro-templates nil
   "Alist containing all macro templates in current buffer.
 Associations are in the shape of (NAME . TEMPLATE) where NAME
 stands for macro's name and template for its replacement value,
-both as strings.
-`t' means that it has not yet been initialized.
-
-This is an internal variable.  Do not set it directly, use instead:
+both as strings.  This is an internal variable.  Do not set it
+directly, use instead:
 
   #+MACRO: name template")
 
index 53943d343d8159c76095be71aecbf2a37cb0d949..aafbdf0e0aab6f55b31c4bb8d6c596bffcd5f8bd 100644 (file)
@@ -132,8 +132,6 @@ Version mismatch is commonly encountered in the following situations:
 
 ;; Use `with-silent-modifications' to ignore cosmetic changes and
 ;; `org-unmodified' to ignore real text modifications.
-;; FIXME: Won't "real text modifications" break the undo data if
-;; `buffer-undo-list' is let-bound to t?
 (defmacro org-unmodified (&rest body)
   "Run BODY while preserving the buffer's `buffer-modified-p' state."
   (declare (debug (body)))
@@ -143,7 +141,7 @@ Version mismatch is commonly encountered in the following situations:
            (let ((buffer-undo-list t)
                 (inhibit-modification-hooks t))
             ,@body)
-        (restore-buffer-modified-p ,was-modified)))))
+        (set-buffer-modified-p ,was-modified)))))
 
 (defmacro org-with-base-buffer (buffer &rest body)
   "Run BODY in base buffer for BUFFER.
index 3fb8fce78d39841f9b8c5a550718930597a3661c..d361408eacaaa921ec21f8919ca88e8e2ee0c137 100644 (file)
@@ -716,9 +716,8 @@ defined in org-duration.el.")
   "Load all extensions listed in `org-modules'."
   (when (or force (not org-modules-loaded))
     (dolist (ext org-modules)
-      (condition-case err (require ext)
-       (error (message "Problems while trying to load feature `%s':\n%S"
-                       ext err))))
+      (condition-case nil (require ext)
+       (error (message "Problems while trying to load feature `%s'" ext))))
     (setq org-modules-loaded t)))
 
 (defun org-set-modules (var value)
@@ -856,7 +855,7 @@ depends on, if any."
   :group 'org-export
   :version "26.1"
   :package-version '(Org . "9.0")
-  :initialize #'custom-initialize-set
+  :initialize 'custom-initialize-set
   :set (lambda (var val)
         (if (not (featurep 'ox)) (set-default-toplevel-value var val)
           ;; Any back-end not required anymore (not present in VAL and not
@@ -906,9 +905,9 @@ depends on, if any."
 
 (eval-after-load 'ox
   '(dolist (backend org-export-backends)
-     (condition-case err (require (intern (format "ox-%s" backend)))
-       (error (message "Problems while trying to load export back-end `%s':\n%S"
-                      backend err)))))
+     (condition-case nil (require (intern (format "ox-%s" backend)))
+       (error (message "Problems while trying to load export back-end `%s'"
+                      backend)))))
 
 (defcustom org-support-shift-select nil
   "Non-nil means make shift-cursor commands select text when possible.
@@ -4773,7 +4772,7 @@ This is for getting out of special buffers like capture.")
 (require 'org-pcomplete)
 (require 'org-src)
 (require 'org-footnote)
-;; (require 'org-macro)
+(require 'org-macro)
 
 ;; babel
 (require 'ob)
@@ -4853,6 +4852,8 @@ The following commands are available:
   (when (and org-element-cache-persistent
              org-element-use-cache)
     (org-persist-load 'org-element--cache (current-buffer) t))
+  ;; Initialize macros templates.
+  (org-macro-initialize-templates)
   ;; Initialize radio targets.
   (org-update-radio-target-regexp)
   ;; Indentation.
@@ -10458,7 +10459,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
         org-log-note-this-command this-command
         org-log-note-recursion-depth (recursion-depth)
         org-log-setup t)
-  (add-hook 'post-command-hook #'org-add-log-note 'append))
+  (add-hook 'post-command-hook 'org-add-log-note 'append))
 
 (defun org-skip-over-state-notes ()
   "Skip past the list of State notes in an entry."
@@ -10487,7 +10488,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
   "Pop up a window for taking a note, and add this note later."
   (when (and (equal org-log-note-this-command this-command)
              (= org-log-note-recursion-depth (recursion-depth)))
-    (remove-hook 'post-command-hook #'org-add-log-note)
+    (remove-hook 'post-command-hook 'org-add-log-note)
     (setq org-log-setup nil)
     (setq org-log-note-window-configuration (current-window-configuration))
     (delete-other-windows)