Browse Source

Deprecate `org-called-interactively-p' in favor of `called-interactively-p'

* lisp/org-compat.el (org-called-interactively-p): Make it an obsolete
  alias for `called-interactively-p'.
* lisp/org-macs.el (org-called-interactively-p): Remove function.
* contrib/lisp/org-expiry.el (org-expiry-insinuate):
(org-expiry-deinsinuate):
(org-expiry-process-entry):
(org-expiry-process-entries):
(org-expiry-archive-subtree):
(org-expiry-add-keyword):
* lisp/ob-core.el (org-babel-expand-src-block):
(org-babel-sha1-hash):
* lisp/org-agenda.el (org-toggle-sticky-agenda):
(org-agenda-write):
(org-agenda-dim-blocked-tasks):
(org-agenda-redo):
(org-agenda-show-1):
(org-agenda-set-tags):
* lisp/org-lint.el (org-lint):
* lisp/org-table.el (org-table-blank-field):
(org-table-current-column):
(org-table-current-dline):
(org-table-sort-lines):
(org-table-sum):
(org-table-rotate-recalc-marks):
(org-table-eval-formula):
(orgtbl-send-table):
* lisp/org.el (org-mode):
(org-copy-subtree):
(org-paste-subtree):
(org-store-link):
(org-todo):
(org-occur):
(org-create-math-formula):
(org-toggle-inline-images):
(org-mark-subtree):
(org-mark-element): Apply removal.
Nicolas Goaziou 3 years ago
parent
commit
999f224299
8 changed files with 48 additions and 56 deletions
  1. 7 7
      contrib/lisp/org-expiry.el
  2. 2 2
      lisp/ob-core.el
  3. 9 9
      lisp/org-agenda.el
  4. 1 0
      lisp/org-compat.el
  5. 2 2
      lisp/org-lint.el
  6. 0 9
      lisp/org-macs.el
  7. 11 11
      lisp/org-table.el
  8. 16 16
      lisp/org.el

+ 7 - 7
contrib/lisp/org-expiry.el

@@ -186,7 +186,7 @@ restart `org-mode' if necessary."
     ;; need this to refresh org-mode hooks
     (when (eq major-mode 'org-mode)
       (org-mode)
-      (if (org-called-interactively-p)
+      (if (called-interactively-p 'any)
 	  (message "Org-expiry insinuated, `org-mode' restarted.")))))
 
 (defun org-expiry-deinsinuate (&optional arg)
@@ -207,7 +207,7 @@ and restart `org-mode' if necessary."
     ;; need this to refresh org-mode hooks
     (when (eq major-mode 'org-mode)
       (org-mode)
-      (if (org-called-interactively-p)
+      (if (called-interactively-p 'any)
 	  (message "Org-expiry de-insinuated, `org-mode' restarted.")))))
 
 ;;; org-expiry-expired-p:
@@ -239,8 +239,8 @@ If FORCE is non-nil, don't require confirmation from the user.
 Otherwise rely on `org-expiry-confirm-flag' to decide."
   (interactive "P")
   (save-excursion
-    (when (org-called-interactively-p) (org-reveal))
-    (when (org-expiry-expired-p)
+    (when (called-interactively-p) (org-reveal))
+    (when (org-expiry-expired-p 'any)
       (org-back-to-heading)
       (looking-at org-complex-heading-regexp)
       (let* ((ov (make-overlay (point) (match-end 0)))
@@ -271,7 +271,7 @@ The expiry process will run the function defined by
 	(while (and (outline-next-heading) (< (point) end))
 	  (when (org-expiry-expired-p)
 	    (setq expired (1+ expired))
-	    (if (if (org-called-interactively-p)
+	    (if (if (called-interactively-p 'any)
 		    (call-interactively 'org-expiry-process-entry)
 		  (org-expiry-process-entry))
 		(setq processed (1+ processed)))))
@@ -339,7 +339,7 @@ and insert today's date."
   (save-excursion
     (if (org-expiry-expired-p)
 	(org-archive-subtree)
-      (if (org-called-interactively-p)
+      (if (called-interactively-p 'any)
 	  (message "Entry at point is not expired.")))))
 
 (defun org-expiry-add-keyword (&optional keyword)
@@ -350,7 +350,7 @@ and insert today's date."
       (save-excursion
 	(if (org-expiry-expired-p)
 	    (org-todo keyword)
-	  (if (org-called-interactively-p)
+	  (if (called-interactively-p 'any)
 	      (message "Entry at point is not expired."))))
     (error "\"%s\" is not a to-do keyword in this buffer" keyword)))
 

+ 2 - 2
lisp/ob-core.el

@@ -756,7 +756,7 @@ arguments and pop open the results in a preview buffer."
 	    (org-babel-expand-body:generic
 	     body params (and (fboundp assignments-cmd)
 			      (funcall assignments-cmd params))))))
-    (if (org-called-interactively-p 'any)
+    (if (called-interactively-p 'any)
 	(org-edit-src-code
 	 expanded (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*"))
       expanded)))
@@ -1254,7 +1254,7 @@ the current subtree."
                                             (nth 2 info))) ":")
                          expanded))
              (hash (sha1 it)))
-        (when (org-called-interactively-p 'interactive) (message hash))
+        (when (called-interactively-p 'interactive) (message hash))
         hash))))
 
 (defun org-babel-current-result-hash (&optional info)

+ 9 - 9
lisp/org-agenda.el

@@ -2076,12 +2076,12 @@ When nil, `q' will kill the single agenda buffer."
 		       (> (prefix-numeric-value arg) 0)
 		     (not org-agenda-sticky))))
     (if (equal new-value org-agenda-sticky)
-	(and (org-called-interactively-p 'interactive)
+	(and (called-interactively-p 'interactive)
 	     (message "Sticky agenda was already %s"
 		      (if org-agenda-sticky "enabled" "disabled")))
       (setq org-agenda-sticky new-value)
       (org-agenda-kill-all-agenda-buffers)
-      (and (org-called-interactively-p 'interactive)
+      (and (called-interactively-p 'interactive)
 	   (message "Sticky agenda %s"
 		    (if org-agenda-sticky "enabled" "disabled"))))))
 
@@ -3347,7 +3347,7 @@ the agenda to write."
   (interactive "FWrite agenda to file: \nP")
   (if (or (not (file-writable-p file))
 	  (and (file-exists-p file)
-	       (if (org-called-interactively-p 'any)
+	       (if (called-interactively-p 'any)
 		   (not (y-or-n-p (format "Overwrite existing file %s? " file))))))
       (user-error "Cannot write agenda to file %s" file))
   (org-let (if nosettings nil org-agenda-exporter-settings)
@@ -3420,7 +3420,7 @@ the agenda to write."
 		 (kill-buffer (current-buffer))
 		 (message "Plain text written to %s" file))))))))
     (set-buffer (or agenda-bufname
-		    (and (org-called-interactively-p 'any) (buffer-name))
+		    (and (called-interactively-p 'any) (buffer-name))
 		    org-agenda-buffer-name)))
   (when open (org-open-file file)))
 
@@ -3867,7 +3867,7 @@ FILTER-ALIST is an alist of filters we need to apply when
 When INVISIBLE is non-nil, hide currently blocked TODO instead of
 dimming them."
   (interactive "P")
-  (when (org-called-interactively-p 'interactive)
+  (when (called-interactively-p 'interactive)
     (message "Dim or hide blocked tasks..."))
   (dolist (o (overlays-in (point-min) (point-max)))
     (when (eq (overlay-get o 'org-type) 'org-blocked-todo)
@@ -3899,7 +3899,7 @@ dimming them."
 		(overlay-put ov 'face 'org-agenda-dimmed-todo-face))
 	      (overlay-put ov 'org-type 'org-blocked-todo))))
 	(forward-line))))
-  (when (org-called-interactively-p 'interactive)
+  (when (called-interactively-p 'interactive)
     (message "Dim or hide blocked tasks...done")))
 
 (defvar org-agenda-skip-function nil
@@ -7386,7 +7386,7 @@ in the agenda."
       (when effort (org-agenda-filter-apply effort 'effort))
       (when re  (org-agenda-filter-apply re 'regexp)))
     (and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter))
-    (and cols (org-called-interactively-p 'any) (org-agenda-columns))
+    (and cols (called-interactively-p 'any) (org-agenda-columns))
     (org-goto-line line)
     (recenter window-line)))
 
@@ -8718,7 +8718,7 @@ if it was hidden in the outline."
 	(org-back-to-heading)
 	(run-hook-with-args 'org-cycle-hook 'folded))
       (message "Remote: FOLDED"))
-     ((and (org-called-interactively-p 'any) (= more 1))
+     ((and (called-interactively-p 'any) (= more 1))
       (message "Remote: show with default settings"))
      ((= more 2)
       (outline-show-entry)
@@ -9052,7 +9052,7 @@ Called with a universal prefix arg, show the priority instead of setting it."
   "Set tags for the current headline."
   (interactive)
   (org-agenda-check-no-diary)
-  (if (and (org-region-active-p) (org-called-interactively-p 'any))
+  (if (and (org-region-active-p) (called-interactively-p 'any))
       (call-interactively 'org-change-tag-in-region)
     (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
 			 (org-agenda-error)))

+ 1 - 0
lisp/org-compat.el

@@ -91,6 +91,7 @@
 
 ;;;; Functions available since Emacs 24.3
 (define-obsolete-function-alias 'org-buffer-narrowed-p 'buffer-narrowed-p "Org 9.0")
+(define-obsolete-function-alias 'org-called-interactively-p 'called-interactively-p "Org 9.0")
 (define-obsolete-function-alias 'org-char-to-string 'char-to-string "Org 9.0")
 (define-obsolete-function-alias 'org-delete-directory 'delete-directory "Org 9.0")
 (define-obsolete-function-alias 'org-number-sequence 'number-sequence "Org 9.0")

+ 2 - 2
lisp/org-lint.el

@@ -1169,7 +1169,7 @@ checker by its name.
 ARG can also be a list of checker names, as symbols, to run."
   (interactive "P")
   (unless (derived-mode-p 'org-mode) (user-error "Not in an Org buffer"))
-  (when (org-called-interactively-p)
+  (when (called-interactively-p 'any)
     (message "Org linting process starting..."))
   (let ((checkers
 	 (pcase arg
@@ -1198,7 +1198,7 @@ ARG can also be a list of checker names, as symbols, to run."
 	    (cl-remove-if-not (lambda (c) (memq (org-lint-checker-name c) arg))
 			       org-lint--checkers))
 	   (_ (user-error "Invalid argument `%S' for `org-lint'" arg)))))
-    (if (not (org-called-interactively-p))
+    (if (not (called-interactively-p 'any))
 	(org-lint--generate-reports (current-buffer) checkers)
       (org-lint--display-reports (current-buffer) checkers)
       (message "Org linting process completed"))))

+ 0 - 9
lisp/org-macs.el

@@ -38,15 +38,6 @@
                  symbols)
      ,@body))
 
-(defmacro org-called-interactively-p (&optional kind)
-  (declare (debug (&optional ("quote" symbolp)))) ;Why not just t?
-  (if (or (> emacs-major-version 23)
-	  (and (>= emacs-major-version 23)
-	       (>= emacs-minor-version 2)))
-      ;; defined with no argument in <=23.1
-      `(with-no-warnings (called-interactively-p ,kind))
-    `(interactive-p)))
-
 (defun org-string-nw-p (s)
   "Return S if S is a string containing a non-blank character.
 Otherwise, return nil."

+ 11 - 11
lisp/org-table.el

@@ -1234,7 +1234,7 @@ Return t when the line exists, nil if it does not exist."
   "Blank the current table field or active region."
   (interactive)
   (org-table-check-inside-data-field)
-  (if (and (org-called-interactively-p 'any) (org-region-active-p))
+  (if (and (called-interactively-p 'any) (org-region-active-p))
       (let (org-table-clip)
 	(org-table-cut-region (region-beginning) (region-end)))
     (skip-chars-backward "^|")
@@ -1313,12 +1313,12 @@ is always the old value."
 (defun org-table-current-column ()
   "Find out which column we are in."
   (interactive)
-  (when (org-called-interactively-p 'any) (org-table-check-inside-data-field))
+  (when (called-interactively-p 'any) (org-table-check-inside-data-field))
   (save-excursion
     (let ((column 0) (pos (point)))
       (beginning-of-line)
       (while (search-forward "|" pos t) (cl-incf column))
-      (when (org-called-interactively-p 'interactive)
+      (when (called-interactively-p 'interactive)
 	(message "In table column %d" column))
       column)))
 
@@ -1327,7 +1327,7 @@ is always the old value."
   "Find out what table data line we are in.
 Only data lines count for this."
   (interactive)
-  (when (org-called-interactively-p 'any)
+  (when (called-interactively-p 'any)
     (org-table-check-inside-data-field))
   (save-excursion
     (let ((c 0)
@@ -1336,7 +1336,7 @@ Only data lines count for this."
       (while (<= (point) pos)
 	(when (looking-at org-table-dataline-regexp) (cl-incf c))
 	(forward-line))
-      (when (org-called-interactively-p 'any)
+      (when (called-interactively-p 'any)
 	(message "This is table line %d" c))
       c)))
 
@@ -1678,7 +1678,7 @@ numeric compare based on the type of the first key in the table."
   ;; Set appropriate case sensitivity and column used for sorting.
   (let ((column (let ((c (org-table-current-column)))
 		  (cond ((> c 0) c)
-			((org-called-interactively-p 'any)
+			((called-interactively-p 'any)
 			 (read-number "Use column N for sorting: "))
 			(t 1))))
 	(sorting-type
@@ -1726,7 +1726,7 @@ numeric compare based on the type of the first key in the table."
 			 (t 0))))
 		((?f ?F)
 		 (or getkey-func
-		     (and (org-called-interactively-p 'any)
+		     (and (called-interactively-p 'any)
 			  (intern
 			   (completing-read "Sort using function: "
 					    obarray #'fboundp t)))
@@ -2138,7 +2138,7 @@ If NLAST is a number, only the NLAST fields will actually be summed."
 			   s diff)
 		     (format "%.0f:%02.0f:%02.0f" h m s))))
 	(kill-new sres)
-	(when (org-called-interactively-p 'interactive)
+	(when (called-interactively-p 'interactive)
 	    (message "%s" (substitute-command-keys
 			   (format "Sum of %d items: %-20s     \
 \(\\[yank] will insert result into buffer)" (length numbers) sres))))
@@ -2466,7 +2466,7 @@ of the new mark."
     (when l1 (set-marker l1 nil))
     (when l2 (set-marker l2 nil))
     (set-marker l nil)
-    (when (org-called-interactively-p 'interactive)
+    (when (called-interactively-p 'interactive)
       (message "%s" (cdr (assoc newchar org-recalc-marks))))))
 
 ;;;###autoload
@@ -2890,7 +2890,7 @@ $1->    %s\n" orig formula form0 form))
 			     (if fmt (format fmt (string-to-number ev)) ev)))))
 	  (setq bw (get-buffer-window "*Substitution History*"))
 	  (org-fit-window-to-buffer bw)
-	  (unless (and (org-called-interactively-p 'any) (not ndown))
+	  (unless (and (called-interactively-p 'any) (not ndown))
 	    (unless (let (inhibit-redisplay)
 		      (y-or-n-p "Debugging Formula.  Continue to next? "))
 	      (org-table-align)
@@ -4651,7 +4651,7 @@ for this table."
   (catch 'exit
     (unless (org-at-table-p) (user-error "Not at a table"))
     ;; when non-interactive, we assume align has just happened.
-    (when (org-called-interactively-p 'any) (org-table-align))
+    (when (called-interactively-p 'any) (org-table-align))
     (let ((dests (orgtbl-gather-send-defs))
 	  (table (org-table-to-lisp
 		  (buffer-substring-no-properties (org-table-begin)

+ 16 - 16
lisp/org.el

@@ -5592,7 +5592,7 @@ The following commands are available:
   ;; If empty file that did not turn on Org mode automatically, make
   ;; it to.
   (when (and org-insert-mode-line-in-empty-file
-	     (org-called-interactively-p 'any)
+	     (called-interactively-p 'any)
 	     (= (point-min) (point-max)))
     (insert "#    -*- mode: org -*-\n\n"))
   (unless org-inhibit-startup
@@ -8543,7 +8543,7 @@ of some markers in the region, even if CUT is non-nil.  This is
 useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
   (interactive "p")
   (let (beg end folded (beg0 (point)))
-    (if (org-called-interactively-p 'any)
+    (if (called-interactively-p 'any)
 	(org-back-to-heading nil) ; take what looks like a subtree
       (org-back-to-heading t)) ; take what is really there
     (setq beg (point))
@@ -8673,7 +8673,7 @@ When REMOVE is non-nil, remove the subtree from the clipboard."
 	   (setq shift (+ delta shift)))
 	 (goto-char (point-min))
 	 (setq newend (point-max))))
-     (when (or (org-called-interactively-p 'interactive) for-yank)
+     (when (or (called-interactively-p 'interactive) for-yank)
        (message "Clipboard pasted as level %d subtree" new-level))
      (when (and (not for-yank) ; in this case, org-yank will decide about folding
 		kill-ring
@@ -9805,7 +9805,7 @@ active region."
 	     (looking-at (concat (format org-coderef-label-format "\\(.*?\\)")
 				 "[ \t]*$")))
 	   (setq link (format "(%s)" (match-string-no-properties 1))))
-	  ((org-called-interactively-p 'any)
+	  ((called-interactively-p 'any)
 	   (let (label)
 	     (while (or (not label)
 			(org-with-wide-buffer
@@ -9831,7 +9831,7 @@ active region."
 	   (when m
 	     (org-with-point-at m
 	       (setq agenda-link
-		     (if (org-called-interactively-p 'any)
+		     (if (called-interactively-p 'any)
 			 (call-interactively 'org-store-link)
 		       (org-store-link nil)))))))
 
@@ -9896,7 +9896,7 @@ active region."
 		 link cpltxt))
 	  ((and (featurep 'org-id)
 		(or (eq org-id-link-to-org-use-id t)
-		    (and (org-called-interactively-p 'any)
+		    (and (called-interactively-p 'any)
 			 (or (eq org-id-link-to-org-use-id 'create-if-interactive)
 			     (and (eq org-id-link-to-org-use-id
 				      'create-if-interactive-and-no-custom-id)
@@ -9957,7 +9957,7 @@ active region."
 		   desc "NONE")))
 	 (setq link cpltxt))
 
-	((org-called-interactively-p 'interactive)
+	((called-interactively-p 'interactive)
 	 (user-error "No method for storing a link from this buffer"))
 
 	(t (setq link nil)))
@@ -9974,7 +9974,7 @@ active region."
 		       (lambda (m) (or (match-string 5 m) (match-string 3 m)))
 		       desc))))
        ;; Return the link
-       (if (not (and (or (org-called-interactively-p 'any)
+       (if (not (and (or (called-interactively-p 'any)
 			 executing-kbd-macro)
                      link))
 	   (or agenda-link (and link (org-make-link-string link desc)))
@@ -12639,7 +12639,7 @@ When called through ELisp, arg is also interpreted in the following way:
 			  (org-with-wide-buffer
 			   (run-hook-with-args-until-failure
 			    'org-blocker-hook change-plist))))
-		(if (org-called-interactively-p 'interactive)
+		(if (called-interactively-p 'interactive)
 		    (user-error "TODO state change from %s to %s blocked (by \"%s\")"
 				this org-state org-block-entry-blocking)
 		  ;; fail silently
@@ -13979,7 +13979,7 @@ The function must neither move point nor alter narrowing."
     (unless org-sparse-tree-open-archived-trees
       (org-hide-archived-subtrees (point-min) (point-max)))
     (run-hooks 'org-occur-hook)
-    (when (org-called-interactively-p 'interactive)
+    (when (called-interactively-p 'interactive)
       (message "%d match(es) for regexp %s" cnt regexp))
     cnt))
 
@@ -19306,7 +19306,7 @@ inspection."
 		 (?i . ,latex-frag)
 		 (?o . ,(shell-quote-argument tmp-out-file)))))
 	 mathml shell-command-output)
-    (when (org-called-interactively-p 'any)
+    (when (called-interactively-p 'any)
       (unless (org-format-latex-mathml-available-p)
 	(user-error "LaTeX to MathML converter not configured")))
     (message "Running %s" cmd)
@@ -19330,7 +19330,7 @@ inspection."
 	    (concat "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" mathml))
       (when mathml-file
 	(write-region mathml nil mathml-file))
-      (when (org-called-interactively-p 'any)
+      (when (called-interactively-p 'any)
 	(message mathml)))
      ((message "LaTeX to MathML conversion failed")
       (message shell-command-output)))
@@ -19599,10 +19599,10 @@ INCLUDE-LINKED is passed to `org-display-inline-images'."
   (if org-inline-image-overlays
       (progn
 	(org-remove-inline-images)
-	(when (org-called-interactively-p 'interactive)
+	(when (called-interactively-p 'interactive)
 	  (message "Inline image display turned off")))
     (org-display-inline-images include-linked)
-    (when (org-called-interactively-p 'interactive)
+    (when (called-interactively-p 'interactive)
       (message (if org-inline-image-overlays
 		   (format "%d images displayed inline"
 			   (length org-inline-image-overlays))
@@ -22846,7 +22846,7 @@ hierarchy of headlines by UP levels before marking the subtree."
 	 ((org-before-first-heading-p) (user-error "Not in a subtree"))
 	 (t (outline-previous-visible-heading 1))))
   (when up (while (and (> up 0) (org-up-heading-safe)) (cl-decf up)))
-  (if (org-called-interactively-p 'any)
+  (if (called-interactively-p 'any)
       (call-interactively 'org-mark-element)
     (org-mark-element)))
 
@@ -24874,7 +24874,7 @@ mode) if the mark is active, it marks the next element after the
 ones already marked."
   (interactive)
   (let (deactivate-mark)
-    (if (and (org-called-interactively-p 'any)
+    (if (and (called-interactively-p 'any)
 	     (or (and (eq last-command this-command) (mark t))
 		 (and transient-mark-mode mark-active)))
 	(set-mark