1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-14 09:39:21 +00:00

Fix declare-function and friends in org.el

* lisp/org-table.el (org-table-with-shrunk-field): Move from here...
* lisp/org-macs.el: ...to here

The move is necessary because this macro is used (at compile time) in
org.el.  We cannot leave its definition in org-table, because that
would lead to a require loop.  So we need to put it in org-macs, and
require the latter file in org.el also at compile time.

Finally, update and sort the declare-function calls.
This commit is contained in:
Aaron Ecay 2018-05-10 01:07:57 +01:00
parent 4afb7f747b
commit 581fd90645
3 changed files with 27 additions and 13 deletions

View File

@ -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

View File

@ -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."

View File

@ -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))