diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 9e0acd19a..7280d44c7 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1039,6 +1039,22 @@ move it back by one char before doing this check." (backward-char 1)) (org-invisible-p))) + +;;; Tables + +;; This macro is placed here because it is used in org.el. +;; org-table.el requires org.el. So, if we put this macro in its +;; natural place (org-table), a require loop would result. +(defmacro org-table-with-shrunk-field (&rest body) + "Save field shrunk state, execute BODY and restore state." + (declare (debug (body))) + (org-with-gensyms (end shrunk size) + `(let* ((,shrunk (save-match-data (org-table--shrunk-field))) + (,end (and ,shrunk (copy-marker (overlay-end ,shrunk) t))) + (,size (and ,shrunk (- ,end (overlay-start ,shrunk))))) + (when ,shrunk (delete-overlay ,shrunk)) + (unwind-protect (progn ,@body) + (when ,shrunk (move-overlay ,shrunk (- ,end ,size) ,end)))))) ;;; Time diff --git a/lisp/org-table.el b/lisp/org-table.el index e74002c85..5e072e3ec 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -526,16 +526,8 @@ Field is restored even in case of abnormal exit." (org-table-goto-column ,column) (set-marker ,line nil))))) -(defmacro org-table-with-shrunk-field (&rest body) - "Save field shrunk state, execute BODY and restore state." - (declare (debug (body))) - (org-with-gensyms (end shrunk size) - `(let* ((,shrunk (save-match-data (org-table--shrunk-field))) - (,end (and ,shrunk (copy-marker (overlay-end ,shrunk) t))) - (,size (and ,shrunk (- ,end (overlay-start ,shrunk))))) - (when ,shrunk (delete-overlay ,shrunk)) - (unwind-protect (progn ,@body) - (when ,shrunk (move-overlay ,shrunk (- ,end ,size) ,end)))))) +;;; See org-macs.el for the definition of org-table-with-shrunk-field, +;;; including the reason why it is defined there and not here. (defmacro org-table-with-shrunk-columns (&rest body) "Expand all columns before executing BODY, then shrink them again." diff --git a/lisp/org.el b/lisp/org.el index 518f9dca5..f199fb019 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -90,7 +90,7 @@ (message "You need to run \"make\" or \"make autoloads\" from Org lisp directory") (sit-for 3)))) -(require 'org-macs) +(eval-and-compile (require 'org-macs)) (require 'org-compat) ;; `org-outline-regexp' ought to be a defconst but is let-bound in @@ -161,17 +161,22 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-element-update-syntax "org-element" ()) (declare-function org-export-dispatch "ox" (&optional arg)) (declare-function org-export-get-backend "ox" (name)) +(declare-function org-export-get-backend "ox" (name)) +(declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist)) (declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist)) (declare-function org-feed-goto-inbox "org-feed" (feed)) (declare-function org-feed-update-all "org-feed" ()) (declare-function org-goto "org-goto" (&optional alternative-interface)) +(declare-function org-goto "org-goto" (&optional alternative-interface)) (declare-function org-id-find-id-file "org-id" (id)) (declare-function org-id-get-create "org-id" (&optional force)) (declare-function org-inlinetask-at-task-p "org-inlinetask" ()) (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) (declare-function org-latex-make-preamble "ox-latex" (info &optional template snippet?)) +(declare-function org-latex-make-preamble "ox-latex" (info &optional template snippet?)) (declare-function org-plot/gnuplot "org-plot" (&optional params)) +(declare-function org-table--shrunk-field "org-table" ()) ;; For `org-table-with-shrunk-field'. (declare-function org-table-align "org-table" ()) (declare-function org-table-begin "org-table" (&optional table-type)) (declare-function org-table-beginning-of-field "org-table" (&optional n)) @@ -201,15 +206,16 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-table-toggle-column-width "org-table" (&optional arg)) (declare-function org-table-toggle-coordinate-overlays "org-table" ()) (declare-function org-table-toggle-formula-debugger "org-table" ()) -(declare-function org-table-with-shrunk-field "org-table" (&rest body)) (declare-function org-table-wrap-region "org-table" (arg)) (declare-function org-tags-view "org-agenda" (&optional todo-only match)) (declare-function org-timer "org-timer" (&optional restart no-insert)) (declare-function org-timer-item "org-timer" (&optional arg)) (declare-function org-timer-pause-or-continue "org-timer" (&optional stop)) +(declare-function org-timer-pause-or-continue "org-timer" (&optional stop)) (declare-function org-timer-set-timer "org-timer" (&optional opt)) (declare-function org-timer-start "org-timer" (&optional offset)) (declare-function org-timer-stop "org-timer" ()) +(declare-function org-timer-stop "org-timer" ()) (declare-function org-toggle-archive-tag "org-archive" (&optional find-done)) (declare-function orgtbl-ascii-plot "org-table" (&optional ask)) (declare-function orgtbl-mode "org-table" (&optional arg)) @@ -4477,7 +4483,7 @@ Assume point is already in a table." (unless quietly (message "Mapping tables: done"))) (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (beg end)) -(declare-function org-clock-update-mode-line "org-clock" ()) +(declare-function org-clock-update-mode-line "org-clock" (&optional refresh)) (declare-function org-resolve-clocks "org-clock" (&optional also-non-dangling-p prompt last-valid))