Bläddra i källkod

Deprecate `org-no-warnings' in favor of `with-no-warnings'

* lisp/org-macs.el (org-no-warnings): Rewove macro.
* lisp/org-compat.el (org-no-warnings): Mark `org-no-warnings' as
  obsolete.
* contrib/lisp/org-contacts.el (defvar):
* contrib/lisp/org-wl.el (org-wl-open):
* lisp/org-agenda.el (defvar):
(org-anniversary):
(org-cyclic):
(org-block):
(org-date):
* lisp/org-bbdb.el (defvar):
* lisp/org-clock.el (org-clock-out):
(org-clock-cancel):
* lisp/org-mouse.el (org-mouse-show-context-menu):
* lisp/org.el (org-modify-ts-extra):
(org-order-calendar-date-args): Small refactoring.
* lisp/ox-odt.el (org-odt-htmlfontify-string):
Nicolas Goaziou 8 år sedan
förälder
incheckning
ee7aa9878f

+ 1 - 1
contrib/lisp/org-contacts.el

@@ -674,7 +674,7 @@ description."
       (goto-char marker)
       (goto-char marker)
       (when (eq major-mode 'org-mode) (org-show-context 'agenda)))))
       (when (eq major-mode 'org-mode) (org-show-context 'agenda)))))
 
 
-(org-no-warnings (defvar date)) ;; unprefixed, from calendar.el
+(with-no-warnings (defvar date)) ;; unprefixed, from calendar.el
 (defun org-contacts-anniversaries (&optional field format)
 (defun org-contacts-anniversaries (&optional field format)
   "Compute FIELD anniversary for each contact, returning FORMAT.
   "Compute FIELD anniversary for each contact, returning FORMAT.
 Default FIELD value is \"BIRTHDAY\".
 Default FIELD value is \"BIRTHDAY\".

+ 2 - 2
contrib/lisp/org-wl.el

@@ -279,8 +279,8 @@ for namazu index."
 				      org-wl-namazu-default-index)
 				      org-wl-namazu-default-index)
 				 org-wl-namazu-default-index
 				 org-wl-namazu-default-index
 			       (read-directory-name "Namazu index: ")))))
 			       (read-directory-name "Namazu index: ")))))
-      (if (not (elmo-folder-exists-p (org-no-warnings
-				      (wl-folder-get-elmo-folder folder))))
+      (if (not (elmo-folder-exists-p (with-no-warnings
+				       (wl-folder-get-elmo-folder folder))))
 	  (error "No such folder: %s" folder))
 	  (error "No such folder: %s" folder))
       (let ((old-buf (current-buffer))
       (let ((old-buf (current-buffer))
 	    (old-point (point-marker)))
 	    (old-point (point-marker)))

+ 6 - 6
lisp/org-agenda.el

@@ -96,8 +96,8 @@
 (defvar org-agenda-buffer-name "*Org Agenda*")
 (defvar org-agenda-buffer-name "*Org Agenda*")
 (defvar org-agenda-overriding-header nil)
 (defvar org-agenda-overriding-header nil)
 (defvar org-agenda-title-append nil)
 (defvar org-agenda-title-append nil)
-(org-no-warnings (defvar entry)) ;; unprefixed, from calendar.el
-(org-no-warnings (defvar date))  ;; unprefixed, from calendar.el
+(with-no-warnings (defvar entry)) ;; unprefixed, from calendar.el
+(with-no-warnings (defvar date))  ;; unprefixed, from calendar.el
 (defvar original-date) ; dynamically scoped, calendar.el does scope this
 (defvar original-date) ; dynamically scoped, calendar.el does scope this
 
 
 (defvar org-agenda-undo-list nil
 (defvar org-agenda-undo-list nil
@@ -5767,22 +5767,22 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
 ;; also `european-calendar-style' and use european format
 ;; also `european-calendar-style' and use european format
 (defun org-anniversary (year month day &optional mark)
 (defun org-anniversary (year month day &optional mark)
   "Like `diary-anniversary', but with fixed (ISO) order of arguments."
   "Like `diary-anniversary', but with fixed (ISO) order of arguments."
-  (org-no-warnings
+  (with-no-warnings
    (let ((calendar-date-style 'european) (european-calendar-style t))
    (let ((calendar-date-style 'european) (european-calendar-style t))
      (diary-anniversary day month year mark))))
      (diary-anniversary day month year mark))))
 (defun org-cyclic (N year month day &optional mark)
 (defun org-cyclic (N year month day &optional mark)
   "Like `diary-cyclic', but with fixed (ISO) order of arguments."
   "Like `diary-cyclic', but with fixed (ISO) order of arguments."
-  (org-no-warnings
+  (with-no-warnings
    (let ((calendar-date-style 'european)	(european-calendar-style t))
    (let ((calendar-date-style 'european)	(european-calendar-style t))
      (diary-cyclic N day month year mark))))
      (diary-cyclic N day month year mark))))
 (defun org-block (Y1 M1 D1 Y2 M2 D2 &optional mark)
 (defun org-block (Y1 M1 D1 Y2 M2 D2 &optional mark)
   "Like `diary-block', but with fixed (ISO) order of arguments."
   "Like `diary-block', but with fixed (ISO) order of arguments."
-  (org-no-warnings
+  (with-no-warnings
    (let ((calendar-date-style 'european)	(european-calendar-style t))
    (let ((calendar-date-style 'european)	(european-calendar-style t))
      (diary-block D1 M1 Y1 D2 M2 Y2 mark))))
      (diary-block D1 M1 Y1 D2 M2 Y2 mark))))
 (defun org-date (year month day &optional mark)
 (defun org-date (year month day &optional mark)
   "Like `diary-date', but with fixed (ISO) order of arguments."
   "Like `diary-date', but with fixed (ISO) order of arguments."
-  (org-no-warnings
+  (with-no-warnings
    (let ((calendar-date-style 'european)	(european-calendar-style t))
    (let ((calendar-date-style 'european)	(european-calendar-style t))
      (diary-date day month year mark))))
      (diary-date day month year mark))))
 
 

+ 1 - 1
lisp/org-bbdb.el

@@ -124,7 +124,7 @@
 (declare-function calendar-leap-year-p "calendar" (year))
 (declare-function calendar-leap-year-p "calendar" (year))
 (declare-function diary-ordinal-suffix "diary-lib" (n))
 (declare-function diary-ordinal-suffix "diary-lib" (n))
 
 
-(org-no-warnings (defvar date)) ;; unprefixed, from calendar.el
+(with-no-warnings (defvar date)) ;; unprefixed, from calendar.el
 
 
 ;; Customization
 ;; Customization
 
 

+ 2 - 2
lisp/org-clock.el

@@ -1566,7 +1566,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
 	  ts te s h m remove)
 	  ts te s h m remove)
       (setq org-clock-out-time now)
       (setq org-clock-out-time now)
       (save-excursion ; Do not replace this with `with-current-buffer'.
       (save-excursion ; Do not replace this with `with-current-buffer'.
-	(org-no-warnings (set-buffer (org-clocking-buffer)))
+	(with-no-warnings (set-buffer (org-clocking-buffer)))
 	(save-restriction
 	(save-restriction
 	  (widen)
 	  (widen)
 	  (goto-char org-clock-marker)
 	  (goto-char org-clock-marker)
@@ -1711,7 +1711,7 @@ Optional argument N tells to change by that many units."
     (force-mode-line-update)
     (force-mode-line-update)
     (error "No active clock"))
     (error "No active clock"))
   (save-excursion    ; Do not replace this with `with-current-buffer'.
   (save-excursion    ; Do not replace this with `with-current-buffer'.
-    (org-no-warnings (set-buffer (org-clocking-buffer)))
+    (with-no-warnings (set-buffer (org-clocking-buffer)))
     (goto-char org-clock-marker)
     (goto-char org-clock-marker)
     (if (looking-back (concat "^[ \t]*" org-clock-string ".*")
     (if (looking-back (concat "^[ \t]*" org-clock-string ".*")
 		      (line-beginning-position))
 		      (line-beginning-position))

+ 1 - 3
lisp/org-colview.el

@@ -630,9 +630,7 @@ Where possible, use the standard interface for changing this line."
 (defun org-columns-eval (form)
 (defun org-columns-eval (form)
   (let (hidep)
   (let (hidep)
     (save-excursion
     (save-excursion
-      (beginning-of-line 1)
-      ;; `next-line' is needed here, because it skips invisible line.
-      (condition-case nil (org-no-warnings (next-line 1)) (error nil))
+      (ignore-errors (move-beginning-of-line 2))
       (setq hidep (org-at-heading-p 1)))
       (setq hidep (org-at-heading-p 1)))
     (eval form)
     (eval form)
     (and hidep (outline-hide-entry))))
     (and hidep (outline-hide-entry))))

+ 1 - 0
lisp/org-compat.el

@@ -94,6 +94,7 @@
 (define-obsolete-function-alias 'org-called-interactively-p 'called-interactively-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-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-delete-directory 'delete-directory "Org 9.0")
+(define-obsolete-function-alias 'org-no-warnings 'with-no-warnings "Org 9.0")
 (define-obsolete-function-alias 'org-number-sequence 'number-sequence "Org 9.0")
 (define-obsolete-function-alias 'org-number-sequence 'number-sequence "Org 9.0")
 (define-obsolete-function-alias 'org-pop-to-buffer-same-window 'pop-to-buffer-same-window "Org 9.0")
 (define-obsolete-function-alias 'org-pop-to-buffer-same-window 'pop-to-buffer-same-window "Org 9.0")
 (define-obsolete-function-alias 'org-string-match-p 'string-match-p "Org 9.0")
 (define-obsolete-function-alias 'org-string-match-p 'string-match-p "Org 9.0")

+ 0 - 4
lisp/org-macs.el

@@ -110,10 +110,6 @@ Otherwise return nil."
 	  (goto-char (or ,mpom (point)))
 	  (goto-char (or ,mpom (point)))
 	  ,@body)))))
 	  ,@body)))))
 
 
-(defmacro org-no-warnings (&rest body)
-  (declare (debug (body)))
-  (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
-
 (defmacro org-with-remote-undo (buffer &rest body)
 (defmacro org-with-remote-undo (buffer &rest body)
   "Execute BODY while recording undo information in two buffers."
   "Execute BODY while recording undo information in two buffers."
   (declare (debug (form body)) (indent 1))
   (declare (debug (form body)) (indent 1))

+ 1 - 1
lisp/org-mouse.el

@@ -221,7 +221,7 @@ this function is called.  Otherwise, the current major mode menu is used."
 	    (funcall org-mouse-context-menu-function event)
 	    (funcall org-mouse-context-menu-function event)
 	  (if (fboundp 'mouse-menu-major-mode-map)
 	  (if (fboundp 'mouse-menu-major-mode-map)
 	      (popup-menu (mouse-menu-major-mode-map) event prefix)
 	      (popup-menu (mouse-menu-major-mode-map) event prefix)
-	    (org-no-warnings ; don't warn about fallback, obsolete since 23.1
+	    (with-no-warnings ; don't warn about fallback, obsolete since 23.1
 	     (mouse-major-mode-menu event prefix)))))
 	     (mouse-major-mode-menu event prefix)))))
     (setq this-command 'mouse-save-then-kill)
     (setq this-command 'mouse-save-then-kill)
     (mouse-save-then-kill event)))
     (mouse-save-then-kill event)))

+ 5 - 13
lisp/org.el

@@ -17352,18 +17352,10 @@ DEF-FLAG   is t when a double ++ or -- indicates shift relative to
 The internal representation needed by the calendar is (month day year).
 The internal representation needed by the calendar is (month day year).
 This is a wrapper to handle the brain-dead convention in calendar that
 This is a wrapper to handle the brain-dead convention in calendar that
 user function argument order change dependent on argument order."
 user function argument order change dependent on argument order."
-  (if (boundp 'calendar-date-style)
-      (cond
-       ((eq calendar-date-style 'american)
-	(list arg1 arg2 arg3))
-       ((eq calendar-date-style 'european)
-	(list arg2 arg1 arg3))
-       ((eq calendar-date-style 'iso)
-	(list arg2 arg3 arg1)))
-    (org-no-warnings ;; european-calendar-style is obsolete as of version 23.1
-     (if (bound-and-true-p european-calendar-style)
-	 (list arg2 arg1 arg3)
-       (list arg1 arg2 arg3)))))
+  (pcase calendar-date-style
+    (`american (list arg1 arg2 arg3))
+    (`european (list arg2 arg1 arg3))
+    (`iso (list arg2 arg3 arg1))))
 
 
 (defun org-eval-in-calendar (form &optional keepdate)
 (defun org-eval-in-calendar (form &optional keepdate)
   "Eval FORM in the calendar window and return to current window.
   "Eval FORM in the calendar window and return to current window.
@@ -18202,7 +18194,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like \"--2d\"."
 	      h (string-to-number (match-string 2 s)))
 	      h (string-to-number (match-string 2 s)))
 	(if (org-pos-in-match-range pos 2)
 	(if (org-pos-in-match-range pos 2)
 	    (setq h (+ h n))
 	    (setq h (+ h n))
-	  (setq n (* dm (org-no-warnings (signum n))))
+	  (setq n (* dm (with-no-warnings (signum n))))
 	  (unless (= 0 (setq rem (% m dm)))
 	  (unless (= 0 (setq rem (% m dm)))
 	    (setq m (+ m (if (> n 0) (- rem) (- dm rem)))))
 	    (setq m (+ m (if (> n 0) (- rem) (- dm rem)))))
 	  (setq m (+ m n)))
 	  (setq m (+ m n)))

+ 1 - 1
lisp/ox-odt.el

@@ -3107,7 +3107,7 @@ and prefix with \"OrgSrc\".  For example,
 	  (lambda (style _text-block _text-id _text-begins-block-p)
 	  (lambda (style _text-block _text-id _text-begins-block-p)
 	    (insert (format "<text:span text:style-name=\"%s\">" style))))
 	    (insert (format "<text:span text:style-name=\"%s\">" style))))
 	 (hfy-end-span-handler (lambda () (insert "</text:span>"))))
 	 (hfy-end-span-handler (lambda () (insert "</text:span>"))))
-    (org-no-warnings (htmlfontify-string line))))
+    (with-no-warnings (htmlfontify-string line))))
 
 
 (defun org-odt-do-format-code
 (defun org-odt-do-format-code
   (code info &optional lang refs retain-labels num-start)
   (code info &optional lang refs retain-labels num-start)