aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2015-05-04 11:32:39 -0400
committerStefan Monnier2015-05-04 11:32:39 -0400
commit9d4eaff316fffc00fecb2dc1b655bc0df6953144 (patch)
treeb42f2970f54b217e157eefc8c982e6078d8a0b65 /lisp
parent8c392682fc9938b2ee02cc2741bf6f680281b0c7 (diff)
downloademacs-9d4eaff316fffc00fecb2dc1b655bc0df6953144.tar.gz
emacs-9d4eaff316fffc00fecb2dc1b655bc0df6953144.zip
* lisp/org/org-{macs,list}.el: Fix lexical warnings
* lisp/org/org-list.el (org-list-struct): Remove unused var `ind'. (org-list-get-next-item, org-list-get-prev-item) (org-list-get-children): Mark unused arg `struct'. (org-list-use-alpha-bul-p): Remove unused var `bul'. (org-toggle-checkbox): Mark unused var. (org-update-checkbox-count): Remove unused var `box-num'. (org-adapt-indentation): Declare. (org-list-parse-list): Declare var instead of adding a dummy duplicate. (org-list-send-list): Remove unused var `txt'. (org-list-to-latex, org-list-to-texinfo): Mark unused arg `params'. (org-list-to-subtree): Add prefix to dyn-bind var, and declare them. * lisp/org/org-macs.el: Use `declare'. (org-with-limited-levels): Declare dyn-bound vars.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/org/org-list.el68
-rw-r--r--lisp/org/org-macs.el55
2 files changed, 63 insertions, 60 deletions
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index c8db77bc689..73f24ce7bd8 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -431,7 +431,7 @@ group 4: description tag")
431 (context (org-list-context)) 431 (context (org-list-context))
432 (lim-up (car context)) 432 (lim-up (car context))
433 (drawers-re (concat "^[ \t]*:\\(" 433 (drawers-re (concat "^[ \t]*:\\("
434 (mapconcat 'regexp-quote org-drawers "\\|") 434 (mapconcat #'regexp-quote org-drawers "\\|")
435 "\\):[ \t]*$")) 435 "\\):[ \t]*$"))
436 (inlinetask-re (and (featurep 'org-inlinetask) 436 (inlinetask-re (and (featurep 'org-inlinetask)
437 (org-inlinetask-outline-regexp))) 437 (org-inlinetask-outline-regexp)))
@@ -550,7 +550,7 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
550 ;; Can't use org-drawers-regexp as this function might 550 ;; Can't use org-drawers-regexp as this function might
551 ;; be called in buffers not in Org mode. 551 ;; be called in buffers not in Org mode.
552 (beg-re (concat "^[ \t]*:\\(" 552 (beg-re (concat "^[ \t]*:\\("
553 (mapconcat 'regexp-quote org-drawers "\\|") 553 (mapconcat #'regexp-quote org-drawers "\\|")
554 "\\):[ \t]*$"))) 554 "\\):[ \t]*$")))
555 (when (save-excursion 555 (when (save-excursion
556 (and (not (looking-at beg-re)) 556 (and (not (looking-at beg-re))
@@ -636,12 +636,12 @@ Assume point is at an item."
636 (text-min-ind 10000) 636 (text-min-ind 10000)
637 (item-re (org-item-re)) 637 (item-re (org-item-re))
638 (drawers-re (concat "^[ \t]*:\\(" 638 (drawers-re (concat "^[ \t]*:\\("
639 (mapconcat 'regexp-quote org-drawers "\\|") 639 (mapconcat #'regexp-quote org-drawers "\\|")
640 "\\):[ \t]*$")) 640 "\\):[ \t]*$"))
641 (inlinetask-re (and (featurep 'org-inlinetask) 641 (inlinetask-re (and (featurep 'org-inlinetask)
642 (org-inlinetask-outline-regexp))) 642 (org-inlinetask-outline-regexp)))
643 (beg-cell (cons (point) (org-get-indentation))) 643 (beg-cell (cons (point) (org-get-indentation)))
644 ind itm-lst itm-lst-2 end-lst end-lst-2 struct 644 itm-lst itm-lst-2 end-lst end-lst-2 struct
645 (assoc-at-point 645 (assoc-at-point
646 (function 646 (function
647 ;; Return association at point. 647 ;; Return association at point.
@@ -926,13 +926,13 @@ Value returned is the position of the first child of ITEM."
926 (< ind (org-list-get-ind child-maybe struct))) 926 (< ind (org-list-get-ind child-maybe struct)))
927 child-maybe))) 927 child-maybe)))
928 928
929(defun org-list-get-next-item (item struct prevs) 929(defun org-list-get-next-item (item _struct prevs)
930 "Return next item in same sub-list as ITEM, or nil. 930 "Return next item in same sub-list as ITEM, or nil.
931STRUCT is the list structure. PREVS is the alist of previous 931STRUCT is the list structure. PREVS is the alist of previous
932items, as returned by `org-list-prevs-alist'." 932items, as returned by `org-list-prevs-alist'."
933 (car (rassq item prevs))) 933 (car (rassq item prevs)))
934 934
935(defun org-list-get-prev-item (item struct prevs) 935(defun org-list-get-prev-item (item _struct prevs)
936 "Return previous item in same sub-list as ITEM, or nil. 936 "Return previous item in same sub-list as ITEM, or nil.
937STRUCT is the list structure. PREVS is the alist of previous 937STRUCT is the list structure. PREVS is the alist of previous
938items, as returned by `org-list-prevs-alist'." 938items, as returned by `org-list-prevs-alist'."
@@ -964,7 +964,7 @@ items, as returned by `org-list-prevs-alist'."
964 (push next-item after-item)) 964 (push next-item after-item))
965 (append before-item (list item) (nreverse after-item)))) 965 (append before-item (list item) (nreverse after-item))))
966 966
967(defun org-list-get-children (item struct parents) 967(defun org-list-get-children (item _struct parents)
968 "List all children of ITEM, or nil. 968 "List all children of ITEM, or nil.
969STRUCT is the list structure. PARENTS is the alist of parents, 969STRUCT is the list structure. PARENTS is the alist of parents,
970as returned by `org-list-parents-alist'." 970as returned by `org-list-parents-alist'."
@@ -982,7 +982,7 @@ STRUCT is the list structure."
982(defun org-list-get-bottom-point (struct) 982(defun org-list-get-bottom-point (struct)
983 "Return point at bottom of list. 983 "Return point at bottom of list.
984STRUCT is the list structure." 984STRUCT is the list structure."
985 (apply 'max 985 (apply #'max
986 (mapcar (lambda (e) (org-list-get-item-end (car e) struct)) struct))) 986 (mapcar (lambda (e) (org-list-get-item-end (car e) struct)) struct)))
987 987
988(defun org-list-get-list-begin (item struct prevs) 988(defun org-list-get-list-begin (item struct prevs)
@@ -1630,8 +1630,7 @@ as returned by `org-list-prevs-alist'."
1630 ;; Pretend that bullets are uppercase and check if alphabet 1630 ;; Pretend that bullets are uppercase and check if alphabet
1631 ;; is sufficient, taking counters into account. 1631 ;; is sufficient, taking counters into account.
1632 (while item 1632 (while item
1633 (let ((bul (org-list-get-bullet item struct)) 1633 (let ((count (org-list-get-counter item struct)))
1634 (count (org-list-get-counter item struct)))
1635 ;; Virtually determine current bullet 1634 ;; Virtually determine current bullet
1636 (if (and count (string-match "[a-zA-Z]" count)) 1635 (if (and count (string-match "[a-zA-Z]" count))
1637 ;; Counters are not case-sensitive. 1636 ;; Counters are not case-sensitive.
@@ -1728,7 +1727,7 @@ This function modifies STRUCT."
1728 (replace-match "1" nil nil bullet)) 1727 (replace-match "1" nil nil bullet))
1729 ;; Not an ordered list: keep bullet. 1728 ;; Not an ordered list: keep bullet.
1730 (t bullet))))))))) 1729 (t bullet)))))))))
1731 (mapc fix-bul (mapcar 'car struct)))) 1730 (mapc fix-bul (mapcar #'car struct))))
1732 1731
1733(defun org-list-struct-fix-ind (struct parents &optional bullet-size) 1732(defun org-list-struct-fix-ind (struct parents &optional bullet-size)
1734 "Verify and correct indentation in STRUCT. 1733 "Verify and correct indentation in STRUCT.
@@ -1756,7 +1755,7 @@ This function modifies STRUCT."
1756 org-list-indent-offset)) 1755 org-list-indent-offset))
1757 ;; If no parent, indent like top-point. 1756 ;; If no parent, indent like top-point.
1758 (org-list-set-ind item struct top-ind)))))) 1757 (org-list-set-ind item struct top-ind))))))
1759 (mapc new-ind (mapcar 'car (cdr struct))))) 1758 (mapc new-ind (mapcar #'car (cdr struct)))))
1760 1759
1761(defun org-list-struct-fix-box (struct parents prevs &optional ordered) 1760(defun org-list-struct-fix-box (struct parents prevs &optional ordered)
1762 "Verify and correct checkboxes in STRUCT. 1761 "Verify and correct checkboxes in STRUCT.
@@ -1771,7 +1770,7 @@ break this rule, the function will return the blocking item. In
1771all others cases, the return value will be nil. 1770all others cases, the return value will be nil.
1772 1771
1773This function modifies STRUCT." 1772This function modifies STRUCT."
1774 (let ((all-items (mapcar 'car struct)) 1773 (let ((all-items (mapcar #'car struct))
1775 (set-parent-box 1774 (set-parent-box
1776 (function 1775 (function
1777 (lambda (item) 1776 (lambda (item)
@@ -1942,8 +1941,8 @@ Initial position of cursor is restored after the changes."
1942 ;; same amount of indentation. Each slice follow the pattern 1941 ;; same amount of indentation. Each slice follow the pattern
1943 ;; (END BEG DELTA MAX-IND-OR-NIL). Slices are returned in 1942 ;; (END BEG DELTA MAX-IND-OR-NIL). Slices are returned in
1944 ;; reverse order. 1943 ;; reverse order.
1945 (setq all-ends (sort (append (mapcar 'car itm-shift) 1944 (setq all-ends (sort (append (mapcar #'car itm-shift)
1946 (org-uniquify (mapcar 'car end-list))) 1945 (org-uniquify (mapcar #'car end-list)))
1947 '<)) 1946 '<))
1948 (while (cdr all-ends) 1947 (while (cdr all-ends)
1949 (let* ((up (pop all-ends)) 1948 (let* ((up (pop all-ends))
@@ -2327,7 +2326,7 @@ in subtree, ignoring drawers."
2327 lim-up 2326 lim-up
2328 lim-down 2327 lim-down
2329 (drawer-re (concat "^[ \t]*:\\(" 2328 (drawer-re (concat "^[ \t]*:\\("
2330 (mapconcat 'regexp-quote org-drawers "\\|") 2329 (mapconcat #'regexp-quote org-drawers "\\|")
2331 "\\):[ \t]*$")) 2330 "\\):[ \t]*$"))
2332 (keyword-re (concat "^[ \t]*\\<\\(" org-scheduled-string 2331 (keyword-re (concat "^[ \t]*\\<\\(" org-scheduled-string
2333 "\\|" org-deadline-string 2332 "\\|" org-deadline-string
@@ -2335,7 +2334,7 @@ in subtree, ignoring drawers."
2335 "\\|" org-clock-string "\\)" 2334 "\\|" org-clock-string "\\)"
2336 " *[[<]\\([^]>]+\\)[]>]")) 2335 " *[[<]\\([^]>]+\\)[]>]"))
2337 (orderedp (org-entry-get nil "ORDERED")) 2336 (orderedp (org-entry-get nil "ORDERED"))
2338 (bounds 2337 (_bounds
2339 ;; In a region, start at first item in region. 2338 ;; In a region, start at first item in region.
2340 (cond 2339 (cond
2341 ((org-region-active-p) 2340 ((org-region-active-p)
@@ -2391,7 +2390,7 @@ in subtree, ignoring drawers."
2391 (bottom (copy-marker (org-list-get-bottom-point struct))) 2390 (bottom (copy-marker (org-list-get-bottom-point struct)))
2392 (items-to-toggle (org-remove-if 2391 (items-to-toggle (org-remove-if
2393 (lambda (e) (or (< e lim-up) (> e lim-down))) 2392 (lambda (e) (or (< e lim-up) (> e lim-down)))
2394 (mapcar 'car struct)))) 2393 (mapcar #'car struct))))
2395 (mapc (lambda (e) (org-list-set-checkbox 2394 (mapc (lambda (e) (org-list-set-checkbox
2396 e struct 2395 e struct
2397 ;; If there is no box at item, leave as-is 2396 ;; If there is no box at item, leave as-is
@@ -2473,7 +2472,7 @@ With optional prefix argument ALL, do this for the whole buffer."
2473 (items 2472 (items
2474 (cond 2473 (cond
2475 ((and recursivep item) (org-list-get-subtree item s)) 2474 ((and recursivep item) (org-list-get-subtree item s))
2476 (recursivep (mapcar 'car s)) 2475 (recursivep (mapcar #'car s))
2477 (item (org-list-get-children item s par)) 2476 (item (org-list-get-children item s par))
2478 (t (org-list-get-all-items 2477 (t (org-list-get-all-items
2479 (org-list-get-top-point s) s pre)))) 2478 (org-list-get-top-point s) s pre))))
@@ -2486,7 +2485,7 @@ With optional prefix argument ALL, do this for the whole buffer."
2486 structs) 2485 structs)
2487 (cons c-on c-all))))) 2486 (cons c-on c-all)))))
2488 (backup-end 1) 2487 (backup-end 1)
2489 cookies-list structs-bak box-num) 2488 cookies-list structs-bak)
2490 (goto-char (car bounds)) 2489 (goto-char (car bounds))
2491 ;; 1. Build an alist for each cookie found within BOUNDS. The 2490 ;; 1. Build an alist for each cookie found within BOUNDS. The
2492 ;; key will be position at beginning of cookie and values 2491 ;; key will be position at beginning of cookie and values
@@ -2749,6 +2748,7 @@ If a region is active, all items inside will be moved."
2749 (t (error "Not at an item"))))) 2748 (t (error "Not at an item")))))
2750 2749
2751(defvar org-tab-ind-state) 2750(defvar org-tab-ind-state)
2751(defvar org-adapt-indentation)
2752(defun org-cycle-item-indentation () 2752(defun org-cycle-item-indentation ()
2753 "Cycle levels of indentation of an empty item. 2753 "Cycle levels of indentation of an empty item.
2754The first run indents the item, if applicable. Subsequent runs 2754The first run indents the item, if applicable. Subsequent runs
@@ -2940,13 +2940,13 @@ will be parsed as:
2940 \(3 \"last item\"\)\) 2940 \(3 \"last item\"\)\)
2941 2941
2942Point is left at list end." 2942Point is left at list end."
2943 (defvar parse-item) ;FIXME: Or use `cl-labels' or `letrec'.
2943 (let* ((struct (org-list-struct)) 2944 (let* ((struct (org-list-struct))
2944 (prevs (org-list-prevs-alist struct)) 2945 (prevs (org-list-prevs-alist struct))
2945 (parents (org-list-parents-alist struct)) 2946 (parents (org-list-parents-alist struct))
2946 (top (org-list-get-top-point struct)) 2947 (top (org-list-get-top-point struct))
2947 (bottom (org-list-get-bottom-point struct)) 2948 (bottom (org-list-get-bottom-point struct))
2948 out 2949 out
2949 parse-item ; for byte-compiler
2950 (get-text 2950 (get-text
2951 (function 2951 (function
2952 ;; Return text between BEG and END, trimmed, with 2952 ;; Return text between BEG and END, trimmed, with
@@ -3072,7 +3072,7 @@ for this list."
3072 (re-search-forward (org-item-beginning-re) bottom-point t) 3072 (re-search-forward (org-item-beginning-re) bottom-point t)
3073 (match-beginning 0))) 3073 (match-beginning 0)))
3074 (plain-list (buffer-substring-no-properties top-point bottom-point)) 3074 (plain-list (buffer-substring-no-properties top-point bottom-point))
3075 beg txt) 3075 beg)
3076 (unless (fboundp transform) 3076 (unless (fboundp transform)
3077 (error "No such transformation function %s" transform)) 3077 (error "No such transformation function %s" transform))
3078 (let ((txt (funcall transform plain-list))) 3078 (let ((txt (funcall transform plain-list)))
@@ -3082,7 +3082,8 @@ for this list."
3082 (unless (re-search-forward 3082 (unless (re-search-forward
3083 (concat "BEGIN RECEIVE ORGLST +" 3083 (concat "BEGIN RECEIVE ORGLST +"
3084 name 3084 name
3085 "\\([ \t]\\|$\\)") nil t) 3085 "\\([ \t]\\|$\\)")
3086 nil t)
3086 (error "Don't know where to insert translated list")) 3087 (error "Don't know where to insert translated list"))
3087 (goto-char (match-beginning 0)) 3088 (goto-char (match-beginning 0))
3088 (beginning-of-line 2) 3089 (beginning-of-line 2)
@@ -3230,7 +3231,7 @@ items."
3230 items (or (eval isep) "")))))))) 3231 items (or (eval isep) ""))))))))
3231 (concat (funcall export-sublist list 0) "\n"))) 3232 (concat (funcall export-sublist list 0) "\n")))
3232 3233
3233(defun org-list-to-latex (list &optional params) 3234(defun org-list-to-latex (list &optional _params)
3234 "Convert LIST into a LaTeX list. 3235 "Convert LIST into a LaTeX list.
3235LIST is as string representing the list to transform, as Org 3236LIST is as string representing the list to transform, as Org
3236syntax. Return converted list as a string." 3237syntax. Return converted list as a string."
@@ -3244,7 +3245,7 @@ syntax. Return converted list as a string."
3244 (require 'ox-html) 3245 (require 'ox-html)
3245 (org-export-string-as list 'html t)) 3246 (org-export-string-as list 'html t))
3246 3247
3247(defun org-list-to-texinfo (list &optional params) 3248(defun org-list-to-texinfo (list &optional _params)
3248 "Convert LIST into a Texinfo list. 3249 "Convert LIST into a Texinfo list.
3249LIST is as string representing the list to transform, as Org 3250LIST is as string representing the list to transform, as Org
3250syntax. Return converted list as a string." 3251syntax. Return converted list as a string."
@@ -3255,14 +3256,15 @@ syntax. Return converted list as a string."
3255 "Convert LIST into an Org subtree. 3256 "Convert LIST into an Org subtree.
3256LIST is as returned by `org-list-parse-list'. PARAMS is a property list 3257LIST is as returned by `org-list-parse-list'. PARAMS is a property list
3257with overruling parameters for `org-list-to-generic'." 3258with overruling parameters for `org-list-to-generic'."
3259 (defvar get-stars) (defvar org--blankp)
3258 (let* ((rule (cdr (assq 'heading org-blank-before-new-entry))) 3260 (let* ((rule (cdr (assq 'heading org-blank-before-new-entry)))
3259 (level (org-reduced-level (or (org-current-level) 0))) 3261 (level (org-reduced-level (or (org-current-level) 0)))
3260 (blankp (or (eq rule t) 3262 (org--blankp (or (eq rule t)
3261 (and (eq rule 'auto) 3263 (and (eq rule 'auto)
3262 (save-excursion 3264 (save-excursion
3263 (outline-previous-heading) 3265 (outline-previous-heading)
3264 (org-previous-line-empty-p))))) 3266 (org-previous-line-empty-p)))))
3265 (get-stars 3267 (get-stars ;FIXME: Can't rename without renaming it in org.el as well!
3266 (function 3268 (function
3267 ;; Return the string for the heading, depending on depth D 3269 ;; Return the string for the heading, depending on depth D
3268 ;; of current sub-list. 3270 ;; of current sub-list.
@@ -3277,12 +3279,12 @@ with overruling parameters for `org-list-to-generic'."
3277 list 3279 list
3278 (org-combine-plists 3280 (org-combine-plists
3279 '(:splice t 3281 '(:splice t
3280 :dtstart " " :dtend " " 3282 :dtstart " " :dtend " "
3281 :istart (funcall get-stars depth) 3283 :istart (funcall get-stars depth)
3282 :icount (funcall get-stars depth) 3284 :icount (funcall get-stars depth)
3283 :isep (if blankp "\n\n" "\n") 3285 :isep (if org--blankp "\n\n" "\n")
3284 :csep (if blankp "\n\n" "\n") 3286 :csep (if org--blankp "\n\n" "\n")
3285 :cbon "DONE" :cboff "TODO" :cbtrans "TODO") 3287 :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
3286 params)))) 3288 params))))
3287 3289
3288(provide 'org-list) 3290(provide 'org-list)
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 23c30178080..db09909f404 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -33,7 +33,7 @@
33 33
34(eval-and-compile 34(eval-and-compile
35 (unless (fboundp 'declare-function) 35 (unless (fboundp 'declare-function)
36 (defmacro declare-function (fn file &optional arglist fileonly) 36 (defmacro declare-function (fn file &optional _arglist _fileonly)
37 `(autoload ',fn ,file))) 37 `(autoload ',fn ,file)))
38 38
39 (if (>= emacs-major-version 23) 39 (if (>= emacs-major-version 23)
@@ -48,13 +48,14 @@
48(declare-function org-string-match-p "org-compat" (&rest args)) 48(declare-function org-string-match-p "org-compat" (&rest args))
49 49
50(defmacro org-with-gensyms (symbols &rest body) 50(defmacro org-with-gensyms (symbols &rest body)
51 (declare (debug (sexp body)) (indent 1))
51 `(let ,(mapcar (lambda (s) 52 `(let ,(mapcar (lambda (s)
52 `(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols) 53 `(,s (make-symbol (concat "--" (symbol-name ',s)))))
54 symbols)
53 ,@body)) 55 ,@body))
54(def-edebug-spec org-with-gensyms (sexp body))
55(put 'org-with-gensyms 'lisp-indent-function 1)
56 56
57(defmacro org-called-interactively-p (&optional kind) 57(defmacro org-called-interactively-p (&optional kind)
58 (declare (debug (&optional ("quote" symbolp)))) ;Why not just `t'?
58 (if (featurep 'xemacs) 59 (if (featurep 'xemacs)
59 `(interactive-p) 60 `(interactive-p)
60 (if (or (> emacs-major-version 23) 61 (if (or (> emacs-major-version 23)
@@ -63,12 +64,11 @@
63 ;; defined with no argument in <=23.1 64 ;; defined with no argument in <=23.1
64 `(with-no-warnings (called-interactively-p ,kind)) 65 `(with-no-warnings (called-interactively-p ,kind))
65 `(interactive-p)))) 66 `(interactive-p))))
66(def-edebug-spec org-called-interactively-p (&optional ("quote" symbolp)))
67 67
68(defmacro org-bound-and-true-p (var) 68(defmacro org-bound-and-true-p (var)
69 "Return the value of symbol VAR if it is bound, else nil." 69 "Return the value of symbol VAR if it is bound, else nil."
70 (declare (debug (symbolp)))
70 `(and (boundp (quote ,var)) ,var)) 71 `(and (boundp (quote ,var)) ,var))
71(def-edebug-spec org-bound-and-true-p (symbolp))
72 72
73(defun org-string-nw-p (s) 73(defun org-string-nw-p (s)
74 "Is S a string with a non-white character?" 74 "Is S a string with a non-white character?"
@@ -97,10 +97,11 @@ Otherwise return nil."
97 97
98(defmacro org-re (s) 98(defmacro org-re (s)
99 "Replace posix classes in regular expression." 99 "Replace posix classes in regular expression."
100 (declare (debug (form)))
100 (if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s)) 101 (if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s))
101(def-edebug-spec org-re (form))
102 102
103(defmacro org-preserve-lc (&rest body) 103(defmacro org-preserve-lc (&rest body)
104 (declare (debug (body)))
104 (org-with-gensyms (line col) 105 (org-with-gensyms (line col)
105 `(let ((,line (org-current-line)) 106 `(let ((,line (org-current-line))
106 (,col (current-column))) 107 (,col (current-column)))
@@ -108,12 +109,12 @@ Otherwise return nil."
108 (progn ,@body) 109 (progn ,@body)
109 (org-goto-line ,line) 110 (org-goto-line ,line)
110 (org-move-to-column ,col))))) 111 (org-move-to-column ,col)))))
111(def-edebug-spec org-preserve-lc (body))
112 112
113;; Use `org-with-silent-modifications' to ignore cosmetic changes and 113;; Use `org-with-silent-modifications' to ignore cosmetic changes and
114;; `org-unmodified' to ignore real text modifications 114;; `org-unmodified' to ignore real text modifications
115(defmacro org-unmodified (&rest body) 115(defmacro org-unmodified (&rest body)
116 "Run BODY while preserving the buffer's `buffer-modified-p' state." 116 "Run BODY while preserving the buffer's `buffer-modified-p' state."
117 (declare (debug (body)))
117 (org-with-gensyms (was-modified) 118 (org-with-gensyms (was-modified)
118 `(let ((,was-modified (buffer-modified-p))) 119 `(let ((,was-modified (buffer-modified-p)))
119 (unwind-protect 120 (unwind-protect
@@ -121,9 +122,9 @@ Otherwise return nil."
121 (inhibit-modification-hooks t)) 122 (inhibit-modification-hooks t))
122 ,@body) 123 ,@body)
123 (set-buffer-modified-p ,was-modified))))) 124 (set-buffer-modified-p ,was-modified)))))
124(def-edebug-spec org-unmodified (body))
125 125
126(defmacro org-without-partial-completion (&rest body) 126(defmacro org-without-partial-completion (&rest body)
127 (declare (debug (body)))
127 `(if (and (boundp 'partial-completion-mode) 128 `(if (and (boundp 'partial-completion-mode)
128 partial-completion-mode 129 partial-completion-mode
129 (fboundp 'partial-completion-mode)) 130 (fboundp 'partial-completion-mode))
@@ -133,7 +134,6 @@ Otherwise return nil."
133 ,@body) 134 ,@body)
134 (partial-completion-mode 1)) 135 (partial-completion-mode 1))
135 ,@body)) 136 ,@body))
136(def-edebug-spec org-without-partial-completion (body))
137 137
138;; FIXME: Slated for removal. Current Org mode does not support Emacs < 22 138;; FIXME: Slated for removal. Current Org mode does not support Emacs < 22
139(defmacro org-maybe-intangible (props) 139(defmacro org-maybe-intangible (props)
@@ -150,6 +150,7 @@ We use a macro so that the test can happen at compilation time."
150 150
151(defmacro org-with-point-at (pom &rest body) 151(defmacro org-with-point-at (pom &rest body)
152 "Move to buffer and point of point-or-marker POM for the duration of BODY." 152 "Move to buffer and point of point-or-marker POM for the duration of BODY."
153 (declare (debug (form body)) (indent 1))
153 (org-with-gensyms (mpom) 154 (org-with-gensyms (mpom)
154 `(let ((,mpom ,pom)) 155 `(let ((,mpom ,pom))
155 (save-excursion 156 (save-excursion
@@ -157,15 +158,14 @@ We use a macro so that the test can happen at compilation time."
157 (org-with-wide-buffer 158 (org-with-wide-buffer
158 (goto-char (or ,mpom (point))) 159 (goto-char (or ,mpom (point)))
159 ,@body))))) 160 ,@body)))))
160(def-edebug-spec org-with-point-at (form body))
161(put 'org-with-point-at 'lisp-indent-function 1)
162 161
163(defmacro org-no-warnings (&rest body) 162(defmacro org-no-warnings (&rest body)
163 (declare (debug (body)))
164 (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body)) 164 (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
165(def-edebug-spec org-no-warnings (body))
166 165
167(defmacro org-with-remote-undo (buffer &rest body) 166(defmacro org-with-remote-undo (buffer &rest body)
168 "Execute BODY while recording undo information in two buffers." 167 "Execute BODY while recording undo information in two buffers."
168 (declare (debug (form body)) (indent 1))
169 (org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2) 169 (org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2)
170 `(let ((,cline (org-current-line)) 170 `(let ((,cline (org-current-line))
171 (,cmd this-command) 171 (,cmd this-command)
@@ -187,13 +187,11 @@ We use a macro so that the test can happen at compilation time."
187 ;; remember which buffer to undo 187 ;; remember which buffer to undo
188 (push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2) 188 (push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2)
189 org-agenda-undo-list)))))) 189 org-agenda-undo-list))))))
190(def-edebug-spec org-with-remote-undo (form body))
191(put 'org-with-remote-undo 'lisp-indent-function 1)
192 190
193(defmacro org-no-read-only (&rest body) 191(defmacro org-no-read-only (&rest body)
194 "Inhibit read-only for BODY." 192 "Inhibit read-only for BODY."
193 (declare (debug (body)))
195 `(let ((inhibit-read-only t)) ,@body)) 194 `(let ((inhibit-read-only t)) ,@body))
196(def-edebug-spec org-no-read-only (body))
197 195
198(defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t 196(defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
199 rear-nonsticky t mouse-map t fontified t 197 rear-nonsticky t mouse-map t fontified t
@@ -313,7 +311,7 @@ This means that the buffer may change while running BODY,
313but it also means that the buffer should stay alive 311but it also means that the buffer should stay alive
314during the operation, because otherwise all these markers will 312during the operation, because otherwise all these markers will
315point nowhere." 313point nowhere."
316 (declare (indent 1)) 314 (declare (debug (form body)) (indent 1))
317 (org-with-gensyms (data rtn) 315 (org-with-gensyms (data rtn)
318 `(let ((,data (org-outline-overlay-data ,use-markers)) 316 `(let ((,data (org-outline-overlay-data ,use-markers))
319 ,rtn) 317 ,rtn)
@@ -327,24 +325,28 @@ point nowhere."
327 (and (markerp (cdr c)) (move-marker (cdr c) nil))) 325 (and (markerp (cdr c)) (move-marker (cdr c) nil)))
328 ,data))) 326 ,data)))
329 ,rtn))) 327 ,rtn)))
330(def-edebug-spec org-save-outline-visibility (form body))
331 328
332(defmacro org-with-wide-buffer (&rest body) 329(defmacro org-with-wide-buffer (&rest body)
333 "Execute body while temporarily widening the buffer." 330 "Execute body while temporarily widening the buffer."
331 (declare (debug (body)))
334 `(save-excursion 332 `(save-excursion
335 (save-restriction 333 (save-restriction
336 (widen) 334 (widen)
337 ,@body))) 335 ,@body)))
338(def-edebug-spec org-with-wide-buffer (body))
339 336
340(defmacro org-with-limited-levels (&rest body) 337(defmacro org-with-limited-levels (&rest body)
341 "Execute BODY with limited number of outline levels." 338 "Execute BODY with limited number of outline levels."
342 `(let* ((org-called-with-limited-levels t) 339 (declare (debug (body)))
343 (org-outline-regexp (org-get-limited-outline-regexp)) 340 `(progn
344 (outline-regexp org-outline-regexp) 341 (defvar org-called-with-limited-levels)
345 (org-outline-regexp-bol (concat "^" org-outline-regexp))) 342 (defvar org-outline-regexp)
346 ,@body)) 343 (defvar outline-regexp)
347(def-edebug-spec org-with-limited-levels (body)) 344 (defvar org-outline-regexp-bol)
345 (let* ((org-called-with-limited-levels t)
346 (org-outline-regexp (org-get-limited-outline-regexp))
347 (outline-regexp org-outline-regexp)
348 (org-outline-regexp-bol (concat "^" org-outline-regexp)))
349 ,@body)))
348 350
349(defvar org-outline-regexp) ; defined in org.el 351(defvar org-outline-regexp) ; defined in org.el
350(defvar org-odd-levels-only) ; defined in org.el 352(defvar org-odd-levels-only) ; defined in org.el
@@ -365,9 +367,8 @@ The number of levels is controlled by `org-inlinetask-min-level'"
365 (format-time-string string (seconds-to-time seconds)))) 367 (format-time-string string (seconds-to-time seconds))))
366 368
367(defmacro org-eval-in-environment (environment form) 369(defmacro org-eval-in-environment (environment form)
370 (declare (debug (form form)) (indent 1))
368 `(eval (list 'let ,environment ',form))) 371 `(eval (list 'let ,environment ',form)))
369(def-edebug-spec org-eval-in-environment (form form))
370(put 'org-eval-in-environment 'lisp-indent-function 1)
371 372
372(defun org-make-parameter-alist (flat) 373(defun org-make-parameter-alist (flat)
373 "Return alist based on FLAT. 374 "Return alist based on FLAT.