Browse Source

Replace interactive-p with the org-called-interactively-p macro.

Interactive-p is an obsolete function as of Emacs 23.2.
`org-called-interactively-p' takes care of the current (x)Emacs
version and use either `interactive-p' (for XEmacs and Emacs<23.2)
or `called-interactively-p'.
Bastien Guerry 6 years ago
parent
commit
2b7dbee193
9 changed files with 42 additions and 42 deletions
  1. 6 6
      contrib/lisp/org-expiry.el
  2. 1 1
      lisp/ob.el
  3. 3 3
      lisp/org-agenda.el
  4. 6 6
      lisp/org-ascii.el
  5. 2 2
      lisp/org-docbook.el
  6. 2 2
      lisp/org-html.el
  7. 2 2
      lisp/org-latex.el
  8. 10 10
      lisp/org-table.el
  9. 10 10
      lisp/org.el

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

@@ -186,7 +186,7 @@ restart `org-mode' if necessary."
     ;; need this to refresh org-mode hooks
     (when (org-mode-p)
       (org-mode)
-      (if (interactive-p)
+      (if (org-called-interactively-p)
 	  (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 (org-mode-p)
       (org-mode)
-      (if (interactive-p)
+      (if (org-called-interactively-p)
 	  (message "Org-expiry de-insinuated, `org-mode' restarted.")))))
 
 ;;; org-expiry-expired-p:
@@ -238,7 +238,7 @@ 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 (interactive-p) (org-reveal))
+    (when (org-called-interactively-p) (org-reveal))
     (when (org-expiry-expired-p)
       (org-back-to-heading)
       (looking-at org-complex-heading-regexp)
@@ -270,7 +270,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 (interactive-p)
+	    (if (if (org-called-interactively-p)
 		    (call-interactively 'org-expiry-process-entry)
 		  (org-expiry-process-entry))
 		(setq processed (1+ processed)))))
@@ -338,7 +338,7 @@ and insert today's date."
   (save-excursion
     (if (org-expiry-expired-p)
 	(org-archive-subtree)
-      (if (interactive-p)
+      (if (org-called-interactively-p)
 	  (message "Entry at point is not expired.")))))
 
 (defun org-expiry-add-keyword (&optional keyword)
@@ -349,7 +349,7 @@ and insert today's date."
       (save-excursion
 	(if (org-expiry-expired-p)
 	    (org-todo keyword)
-	  (if (interactive-p)
+	  (if (org-called-interactively-p)
 	      (message "Entry at point is not expired."))))
     (error "\"%s\" is not a to-do keyword in this buffer" keyword)))
 

+ 1 - 1
lisp/ob.el

@@ -749,7 +749,7 @@ the current subtree."
     (setf (nth 2 info)
 	  (sort (copy-sequence (nth 2 info))
 		(lambda (a b) (string< (car a) (car b)))))
-    ((lambda (hash) (when (interactive-p) (message hash)) hash)
+    ((lambda (hash) (when (org-called-interactively-p) (message hash)) hash)
      (sha1 (format "%s-%s"
 		   (mapconcat
 		    #'identity

+ 3 - 3
lisp/org-agenda.el

@@ -6083,7 +6083,7 @@ When this is the global TODO list, a prefix argument will be interpreted."
     (message "Rebuilding agenda buffer...done")
     (put 'org-agenda-filter :preset-filter preset)
     (and (or filter preset) (org-agenda-filter-apply filter))
-    (and cols (interactive-p) (org-agenda-columns))
+    (and cols (org-called-interactively-p) (org-agenda-columns))
     (org-goto-line line)
     (recenter window-line)))
 
@@ -7034,7 +7034,7 @@ if it was hidden in the outline."
 	(org-back-to-heading)
 	(run-hook-with-args 'org-cycle-hook 'folded))
       (message "Remote: FOLDED"))
-     ((and (interactive-p) (= more 1))
+     ((and (org-called-interactively-p) (= more 1))
       (message "Remote: show with default settings"))
      ((= more 2)
       (show-entry)
@@ -7335,7 +7335,7 @@ the same tree node, and the headline of the tree node in the Org-mode file."
   "Set tags for the current headline."
   (interactive)
   (org-agenda-check-no-diary)
-  (if (and (org-region-active-p) (interactive-p))
+  (if (and (org-region-active-p) (org-called-interactively-p))
       (call-interactively 'org-change-tag-in-region)
     (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
 			 (org-agenda-error)))

+ 6 - 6
lisp/org-ascii.el

@@ -96,28 +96,28 @@ utf8      Use all UTF-8 characters")
 (defun org-export-as-latin1 (&rest args)
   "Like `org-export-as-ascii', use latin1 encoding for special symbols."
   (interactive)
-  (org-export-as-encoding 'org-export-as-ascii (interactive-p)
+  (org-export-as-encoding 'org-export-as-ascii (org-called-interactively-p)
 			  'latin1 args))
 
 ;;;###autoload
 (defun org-export-as-latin1-to-buffer (&rest args)
   "Like `org-export-as-ascii-to-buffer', use latin1 encoding for symbols."
   (interactive)
-  (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p)
+  (org-export-as-encoding 'org-export-as-ascii-to-buffer (org-called-interactively-p)
 			  'latin1 args))
 
 ;;;###autoload
 (defun org-export-as-utf8 (&rest args)
   "Like `org-export-as-ascii', use use encoding for special symbols."
   (interactive)
-  (org-export-as-encoding 'org-export-as-ascii (interactive-p)
+  (org-export-as-encoding 'org-export-as-ascii (org-called-interactively-p)
 			  'utf8 args))
 
 ;;;###autoload
 (defun org-export-as-utf8-to-buffer (&rest args)
   "Like `org-export-as-ascii-to-buffer', use utf8 encoding for symbols."
   (interactive)
-  (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p)
+  (org-export-as-encoding 'org-export-as-ascii-to-buffer (org-called-interactively-p)
 			  'utf8 args))
 
 (defun org-export-as-encoding (command interactivep encoding &rest args)
@@ -176,7 +176,7 @@ a Lisp program could call this function in the following way:
 When called interactively, the output buffer is selected, and shown
 in a window.  A non-interactive call will only return the buffer."
   (interactive "r\nP")
-  (when (interactive-p)
+  (when (org-called-interactively-p)
     (setq buffer "*Org ASCII Export*"))
   (let ((transient-mark-mode t) (zmacs-regions t)
 	ext-plist rtn)
@@ -188,7 +188,7 @@ in a window.  A non-interactive call will only return the buffer."
 	       nil nil ext-plist
 	       buffer body-only))
     (if (fboundp 'deactivate-mark) (deactivate-mark))
-    (if (and (interactive-p) (bufferp rtn))
+    (if (and (org-called-interactively-p) (bufferp rtn))
 	(switch-to-buffer-other-window rtn)
       rtn)))
 

+ 2 - 2
lisp/org-docbook.el

@@ -325,7 +325,7 @@ could call this function in the following way:
 When called interactively, the output buffer is selected, and shown
 in a window.  A non-interactive call will only return the buffer."
   (interactive "r\nP")
-  (when (interactive-p)
+  (when (org-called-interactively-p)
     (setq buffer "*Org DocBook Export*"))
   (let ((transient-mark-mode t)
 	(zmacs-regions t)
@@ -337,7 +337,7 @@ in a window.  A non-interactive call will only return the buffer."
 	       nil nil
 	       buffer body-only))
     (if (fboundp 'deactivate-mark) (deactivate-mark))
-    (if (and (interactive-p) (bufferp rtn))
+    (if (and (org-called-interactively-p) (bufferp rtn))
 	(switch-to-buffer-other-window rtn)
       rtn)))
 

+ 2 - 2
lisp/org-html.el

@@ -724,7 +724,7 @@ a Lisp program could call this function in the following way:
 When called interactively, the output buffer is selected, and shown
 in a window.  A non-interactive call will only return the buffer."
   (interactive "r\nP")
-  (when (interactive-p)
+  (when (org-called-interactively-p)
     (setq buffer "*Org HTML Export*"))
   (let ((transient-mark-mode t) (zmacs-regions t)
 	ext-plist rtn)
@@ -736,7 +736,7 @@ in a window.  A non-interactive call will only return the buffer."
 	       nil nil ext-plist
 	       buffer body-only))
     (if (fboundp 'deactivate-mark) (deactivate-mark))
-    (if (and (interactive-p) (bufferp rtn))
+    (if (and (org-called-interactively-p) (bufferp rtn))
 	(switch-to-buffer-other-window rtn)
       rtn)))
 

+ 2 - 2
lisp/org-latex.el

@@ -717,7 +717,7 @@ a Lisp program could call this function in the following way:
 When called interactively, the output buffer is selected, and shown
 in a window.  A non-interactive call will only return the buffer."
   (interactive "r\nP")
-  (when (interactive-p)
+  (when (org-called-interactively-p)
     (setq buffer "*Org LaTeX Export*"))
   (let ((transient-mark-mode t) (zmacs-regions t)
 	ext-plist rtn)
@@ -729,7 +729,7 @@ in a window.  A non-interactive call will only return the buffer."
 	       nil nil ext-plist
 	       buffer body-only))
     (if (fboundp 'deactivate-mark) (deactivate-mark))
-    (if (and (interactive-p) (bufferp rtn))
+    (if (and (org-called-interactively-p) (bufferp rtn))
 	(switch-to-buffer-other-window rtn)
       rtn)))
 

+ 10 - 10
lisp/org-table.el

@@ -1117,7 +1117,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 (interactive-p) (org-region-active-p))
+  (if (and (org-called-interactively-p) (org-region-active-p))
       (let (org-table-clip)
 	(org-table-cut-region (region-beginning) (region-end)))
     (skip-chars-backward "^|")
@@ -1193,27 +1193,27 @@ is always the old value."
 (defun org-table-current-column ()
   "Find out which column we are in."
   (interactive)
-  (if (interactive-p) (org-table-check-inside-data-field))
+  (if (org-called-interactively-p) (org-table-check-inside-data-field))
   (save-excursion
     (let ((cnt 0) (pos (point)))
       (beginning-of-line 1)
       (while (search-forward "|" pos t)
 	(setq cnt (1+ cnt)))
-      (if (interactive-p) (message "In table column %d" cnt))
+      (if (org-called-interactively-p) (message "In table column %d" cnt))
       cnt)))
 
 (defun org-table-current-dline ()
   "Find out what table data line we are in.
 Only data lines count for this."
   (interactive)
-  (if (interactive-p) (org-table-check-inside-data-field))
+  (if (org-called-interactively-p) (org-table-check-inside-data-field))
   (save-excursion
     (let ((cnt 0) (pos (point)))
       (goto-char (org-table-begin))
       (while (<= (point) pos)
 	(if (looking-at org-table-dataline-regexp) (setq cnt (1+ cnt)))
 	(beginning-of-line 2))
-      (if (interactive-p) (message "This is table line %d" cnt))
+      (if (org-called-interactively-p) (message "This is table line %d" cnt))
       cnt)))
 
 (defun org-table-goto-column (n &optional on-delim force)
@@ -1540,7 +1540,7 @@ should be done in reverse order."
 	 (thiscol (org-table-current-column))
 	 beg end bcol ecol tend tbeg column lns pos)
     (when (equal thiscol 0)
-      (if (interactive-p)
+      (if (org-called-interactively-p)
 	  (setq thiscol
 		(string-to-number
 		 (read-string "Use column N for sorting: ")))
@@ -1933,7 +1933,7 @@ If NLAST is a number, only the NLAST fields will actually be summed."
 			   s diff)
 		     (format "%d:%02d:%02d" h m s))))
 	(kill-new sres)
-	(if (interactive-p)
+	(if (org-called-interactively-p)
 	    (message "%s"
 		     (substitute-command-keys
 		      (format "Sum of %d items: %-20s     (\\[yank] will insert result into buffer)"
@@ -2303,7 +2303,7 @@ of the new mark."
 	  (org-goto-line l1)))
     (if (not (= epos (point-at-eol))) (org-table-align))
     (org-goto-line l)
-    (and (interactive-p) (message "%s" (cdr (assoc new org-recalc-marks))))))
+    (and (org-called-interactively-p) (message "%s" (cdr (assoc new org-recalc-marks))))))
 
 (defun org-table-maybe-recalculate-line ()
   "Recompute the current line if marked for it, and if we haven't just done it."
@@ -2521,7 +2521,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 (interactive-p) (not ndown))
+	  (unless (and (org-called-interactively-p) (not ndown))
 	    (unless (let (inhibit-redisplay)
 		      (y-or-n-p "Debugging Formula.  Continue to next? "))
 	      (org-table-align)
@@ -4149,7 +4149,7 @@ this table."
   (catch 'exit
     (unless (org-at-table-p) (error "Not at a table"))
     ;; when non-interactive, we assume align has just happened.
-    (when (interactive-p) (org-table-align))
+    (when (org-called-interactively-p) (org-table-align))
     (let ((dests (orgtbl-gather-send-defs))
 	  (txt (buffer-substring-no-properties (org-table-begin)
 					       (org-table-end)))

+ 10 - 10
lisp/org.el

@@ -4830,7 +4830,7 @@ The following commands are available:
 
   ;; If empty file that did not turn on org-mode automatically, make it to.
   (if (and org-insert-mode-line-in-empty-file
-	   (interactive-p)
+	   (org-called-interactively-p)
 	   (= (point-min) (point-max)))
       (insert "#    -*- mode: org -*-\n\n"))
   (unless org-inhibit-startup
@@ -7437,7 +7437,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 (interactive-p)
+    (if (org-called-interactively-p)
 	(org-back-to-heading nil) ; take what looks like a subtree
       (org-back-to-heading t)) ; take what is really there
     (org-back-over-empty-lines)
@@ -7566,7 +7566,7 @@ the inserted text when done."
 	  (setq shift (+ delta shift)))
 	(goto-char (point-min))
 	(setq newend (point-max))))
-    (when (or (interactive-p) for-yank)
+    (when (or (org-called-interactively-p) for-yank)
       (message "Clipboard pasted as level %d subtree" new-level))
     (if (and (not for-yank) ; in this case, org-yank will decide about folding
 	     kill-ring
@@ -8443,7 +8443,7 @@ For file links, arg negates `org-context-in-file-links'."
 	 (when m
 	   (org-with-point-at m
 	     (setq agenda-link
-		   (if (interactive-p)
+		   (if (org-called-interactively-p)
 		       (call-interactively 'org-store-link)
 		     (org-store-link nil)))))))
 
@@ -8506,9 +8506,9 @@ For file links, arg negates `org-context-in-file-links'."
 	((and (featurep 'org-id)
 	      (or (eq org-link-to-org-use-id t)
 		  (and (eq org-link-to-org-use-id 'create-if-interactive)
-		       (interactive-p))
+		       (org-called-interactively-p))
 		  (and (eq org-link-to-org-use-id 'create-if-interactive-and-no-custom-id)
-		       (interactive-p)
+		       (org-called-interactively-p)
 		       (not custom-id))
 		  (and org-link-to-org-use-id
 			   (org-entry-get nil "ID"))))
@@ -8563,7 +8563,7 @@ For file links, arg negates `org-context-in-file-links'."
 		 desc "NONE")))
        (setq link (org-make-link cpltxt)))
 
-      ((interactive-p)
+      ((org-called-interactively-p)
        (error "Cannot link to a buffer which is not visiting a file"))
 
       (t (setq link nil)))
@@ -8573,7 +8573,7 @@ For file links, arg negates `org-context-in-file-links'."
 	   desc (or desc cpltxt))
      (if (equal desc "NONE") (setq desc nil))
 
-     (if (and (or (interactive-p) executing-kbd-macro) link)
+     (if (and (or (org-called-interactively-p) executing-kbd-macro) link)
 	 (progn
 	   (setq org-stored-links
 		 (cons (list link desc) org-stored-links))
@@ -11015,7 +11015,7 @@ For calling through lisp, arg is also interpreted in the following way:
 			(org-with-wide-buffer
 			 (run-hook-with-args-until-failure
 			  'org-blocker-hook change-plist))))
-	      (if (interactive-p)
+	      (if (org-called-interactively-p)
 		  (error "TODO state change from %s to %s blocked" this state)
 		;; fail silently
 		(message "TODO state change from %s to %s blocked" this state)
@@ -12162,7 +12162,7 @@ that the match should indeed be shown."
     (unless org-sparse-tree-open-archived-trees
       (org-hide-archived-subtrees (point-min) (point-max)))
     (run-hooks 'org-occur-hook)
-    (if (interactive-p)
+    (if (org-called-interactively-p)
 	(message "%d match(es) for regexp %s" cnt regexp))
     cnt))