emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104471: Silence various byte-compile


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104471: Silence various byte-compiler warnings.
Date: Wed, 01 Jun 2011 16:32:04 -0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104471
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2011-06-01 16:32:04 -0300
message:
  Silence various byte-compiler warnings.
  * lisp/emacs-lisp/byte-run.el (make-obsolete-variable): New argument
  `access-type' and new obsolescence format.
  * lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): Adjust to
  new format.
  (byte-compile-check-variable): New `access-type' argument.
  Only warn if the access-type is obsolete.
  (byte-compile-dynamic-variable-bind, byte-compile-variable-ref)
  (byte-compile-variable-set): Adjust callers.
  * lisp/help-fns.el (describe-variable): Adjust to new obsolescence format.
  * lisp/mail/sendmail.el (mail-mailer-swallows-blank-line): Only mark
  setting it as obsolete.
  * lisp/simple.el (minibuffer-completing-symbol):
  * lisp/font-lock.el (font-lock-beginning-of-syntax-function): Only mark read
  access as obsolete.
  * lisp/minibuffer.el (minibuffer-completing-file-name): Don't make it
  obsolete yet.
  * lisp/international/quail.el (quail-mouse-choose-completion): Remove unused
  code referring to obsolete var.
  (quail-choose-completion-string): Remove.
  * lisp/server.el (server-clients-with, server-kill-buffer-query-function)
  (server-kill-emacs-query-function): Silence "unused `proc'" warnings.
  * lisp/proced.el (proced-send-signal):
  * lisp/emacs-lisp/lisp.el (lisp-complete-symbol):
  Replace completion-annotate-function with completion-extra-properties.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/byte-run.el
  lisp/emacs-lisp/bytecomp.el
  lisp/emacs-lisp/lisp.el
  lisp/font-lock.el
  lisp/help-fns.el
  lisp/international/quail.el
  lisp/mail/sendmail.el
  lisp/minibuffer.el
  lisp/proced.el
  lisp/server.el
  lisp/simple.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-01 15:52:35 +0000
+++ b/lisp/ChangeLog    2011-06-01 19:32:04 +0000
@@ -1,5 +1,33 @@
 2011-06-01  Stefan Monnier  <address@hidden>
 
+       Silence various byte-compiler warnings.
+       * emacs-lisp/byte-run.el (make-obsolete-variable): New argument
+       `access-type' and new obsolescence format.
+       * emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): Adjust to
+       new format.
+       (byte-compile-check-variable): New `access-type' argument.
+       Only warn if the access-type is obsolete.
+       (byte-compile-dynamic-variable-bind, byte-compile-variable-ref)
+       (byte-compile-variable-set): Adjust callers.
+       * help-fns.el (describe-variable): Adjust to new obsolescence format.
+       * mail/sendmail.el (mail-mailer-swallows-blank-line): Only mark
+       setting it as obsolete.
+       * simple.el (minibuffer-completing-symbol):
+       * font-lock.el (font-lock-beginning-of-syntax-function): Only mark read
+       access as obsolete.
+       * minibuffer.el (minibuffer-completing-file-name): Don't make it
+       obsolete yet.
+       * international/quail.el (quail-mouse-choose-completion): Remove unused
+       code referring to obsolete var.
+       (quail-choose-completion-string): Remove.
+       * server.el (server-clients-with, server-kill-buffer-query-function)
+       (server-kill-emacs-query-function): Silence "unused `proc'" warnings.
+       * proced.el (proced-send-signal):
+       * emacs-lisp/lisp.el (lisp-complete-symbol):
+       Replace completion-annotate-function with completion-extra-properties.
+
+2011-06-01  Stefan Monnier  <address@hidden>
+
        * simple.el (goto-line): Use read-number.
        (overriding-map-is-bound): Remove.
        (saved-overriding-map): Change default.

=== modified file 'lisp/emacs-lisp/byte-run.el'
--- a/lisp/emacs-lisp/byte-run.el       2011-06-01 14:19:45 +0000
+++ b/lisp/emacs-lisp/byte-run.el       2011-06-01 19:32:04 +0000
@@ -153,24 +153,21 @@
  'define-obsolete-function-alias
  '(obsolete-name current-name when &optional docstring) "23.1")
 
-(defun make-obsolete-variable (obsolete-name current-name &optional when)
+(defun make-obsolete-variable (obsolete-name current-name &optional when 
access-type)
   "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
 The warning will say that CURRENT-NAME should be used instead.
 If CURRENT-NAME is a string, that is the `use instead' message.
-If provided, WHEN should be a string indicating when the variable
-was first made obsolete, for example a date or a release number."
-  (interactive
-   (list
-    (let ((str (completing-read "Make variable obsolete: " obarray 'boundp t)))
-      (if (equal str "") (error ""))
-      (intern str))
-    (car (read-from-string (read-string "Obsoletion replacement: ")))))
+WHEN should be a string indicating when the variable
+was first made obsolete, for example a date or a release number.
+ACCESS-TYPE if non-nil should specify the kind of access that will trigger
+  obsolescence warnings; it can be either `get' or `set'."
   (put obsolete-name 'byte-obsolete-variable
-       (purecopy (cons current-name when)))
+       (purecopy (list current-name access-type when)))
   obsolete-name)
 (set-advertised-calling-convention
  ;; New code should always provide the `when' argument.
- 'make-obsolete-variable '(obsolete-name current-name when) "23.1")
+ 'make-obsolete-variable
+ '(obsolete-name current-name when &optional access-type) "23.1")
 
 (defmacro define-obsolete-variable-alias (obsolete-name current-name
                                                 &optional when docstring)

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2011-06-01 14:19:45 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2011-06-01 19:32:04 +0000
@@ -1109,7 +1109,7 @@
     (let* ((funcp (get symbol 'byte-obsolete-info))
           (obsolete (or funcp (get symbol 'byte-obsolete-variable)))
           (instead (car obsolete))
-          (asof (if funcp (nth 2 obsolete) (cdr obsolete))))
+          (asof (nth 2 obsolete)))
       (unless (and funcp (memq symbol byte-compile-not-obsolete-funcs))
        (byte-compile-warn "`%s' is an obsolete %s%s%s" symbol
                           (if funcp "function" "variable")
@@ -3016,20 +3016,24 @@
     (assert (eq byte-compile-depth (1+ start-depth))
             nil "Wrong depth start=%s end=%s" start-depth byte-compile-depth)))
 
-(defun byte-compile-check-variable (var &optional binding)
-  "Do various error checks before a use of the variable VAR.
-If BINDING is non-nil, VAR is being bound."
+(defun byte-compile-check-variable (var access-type)
+  "Do various error checks before a use of the variable VAR."
   (when (symbolp var)
     (byte-compile-set-symbol-position var))
   (cond ((or (not (symbolp var)) (byte-compile-const-symbol-p var))
         (when (byte-compile-warning-enabled-p 'constants)
-          (byte-compile-warn (if binding
+          (byte-compile-warn (if (eq access-type 'let-bind)
                                  "attempt to let-bind %s `%s`"
                                "variable reference to %s `%s'")
                              (if (symbolp var) "constant" "nonvariable")
                              (prin1-to-string var))))
-       ((and (get var 'byte-obsolete-variable)
-             (not (memq var byte-compile-not-obsolete-vars)))
+       ((let ((od (get var 'byte-obsolete-variable)))
+           (and od
+                (not (memq var byte-compile-not-obsolete-vars))
+                (or (case (nth 1 od)
+                      (set (not (eq access-type 'reference)))
+                      (get (eq access-type 'reference))
+                      (t t)))))
         (byte-compile-warn-obsolete var))))
 
 (defsubst byte-compile-dynamic-variable-op (base-op var)
@@ -3041,13 +3045,13 @@
 
 (defun byte-compile-dynamic-variable-bind (var)
   "Generate code to bind the lexical variable VAR to the top-of-stack value."
-  (byte-compile-check-variable var t)
+  (byte-compile-check-variable var 'let-bind)
   (push var byte-compile-bound-variables)
   (byte-compile-dynamic-variable-op 'byte-varbind var))
 
 (defun byte-compile-variable-ref (var)
   "Generate code to push the value of the variable VAR on the stack."
-  (byte-compile-check-variable var)
+  (byte-compile-check-variable var 'reference)
   (let ((lex-binding (assq var byte-compile--lexical-environment)))
     (if lex-binding
        ;; VAR is lexically bound
@@ -3063,7 +3067,7 @@
 
 (defun byte-compile-variable-set (var)
   "Generate code to set the variable VAR from the top-of-stack value."
-  (byte-compile-check-variable var)
+  (byte-compile-check-variable var 'assign)
   (let ((lex-binding (assq var byte-compile--lexical-environment)))
     (if lex-binding
        ;; VAR is lexically bound

=== modified file 'lisp/emacs-lisp/lisp.el'
--- a/lisp/emacs-lisp/lisp.el   2011-05-23 16:40:16 +0000
+++ b/lisp/emacs-lisp/lisp.el   2011-06-01 19:32:04 +0000
@@ -636,9 +636,8 @@
          (plist (nthcdr 3 data)))
     (if (null data)
         (minibuffer-message "Nothing to complete")
-    (let ((completion-annotate-function
-           (plist-get plist :annotation-function)))
-      (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)
+      (let ((completion-extra-properties plist))
+        (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)
                               (plist-get plist :predicate))))))
 
 

=== modified file 'lisp/font-lock.el'
--- a/lisp/font-lock.el 2011-04-05 15:20:21 +0000
+++ b/lisp/font-lock.el 2011-06-01 19:32:04 +0000
@@ -563,7 +563,7 @@
 
 This is normally set via `font-lock-defaults'.")
 (make-obsolete-variable 'font-lock-beginning-of-syntax-function
-                        'syntax-begin-function "23.3")
+                        'syntax-begin-function "23.3" 'set)
 
 (defvar font-lock-mark-block-function nil
   "*Non-nil means use this function to mark a block of text.

=== modified file 'lisp/help-fns.el'
--- a/lisp/help-fns.el  2011-06-01 14:19:45 +0000
+++ b/lisp/help-fns.el  2011-06-01 19:32:04 +0000
@@ -805,7 +805,8 @@
               (when obsolete
                 (setq extra-line t)
                 (princ "  This variable is obsolete")
-                (if (cdr obsolete) (princ (format " since %s" (cdr obsolete))))
+                (if (nth 2 obsolete)
+                    (princ (format " since %s" (nth 2 obsolete))))
                (princ (cond ((stringp use) (concat ";\n  " use))
                             (use (format ";\n  use `%s' instead." (car 
obsolete)))
                             (t ".")))

=== modified file 'lisp/international/quail.el'
--- a/lisp/international/quail.el       2011-05-23 17:57:17 +0000
+++ b/lisp/international/quail.el       2011-06-01 19:32:04 +0000
@@ -2253,12 +2253,10 @@
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (let ((buffer (window-buffer))
-        choice
-       base-size)
+        choice)
     (with-current-buffer (window-buffer (posn-window (event-start event)))
       (if completion-reference-buffer
          (setq buffer completion-reference-buffer))
-      (setq base-size completion-base-size)
       (save-excursion
        (goto-char (posn-point (event-start event)))
        (let (beg end)
@@ -2272,26 +2270,23 @@
          (setq end (or (next-single-property-change end 'mouse-face)
                        (point-max)))
          (setq choice (buffer-substring beg end)))))
-;    (let ((owindow (selected-window)))
-;      (select-window (posn-window (event-start event)))
-;      (if (and (one-window-p t 'selected-frame)
-;             (window-dedicated-p (selected-window)))
-;        ;; This is a special buffer's frame
-;        (iconify-frame (selected-frame))
-;      (or (window-dedicated-p (selected-window))
-;          (bury-buffer)))
-;      (select-window owindow))
+    ;; (let ((owindow (selected-window)))
+    ;;   (select-window (posn-window (event-start event)))
+    ;;   (if (and (one-window-p t 'selected-frame)
+    ;;            (window-dedicated-p (selected-window)))
+    ;;       ;; This is a special buffer's frame
+    ;;       (iconify-frame (selected-frame))
+    ;;     (or (window-dedicated-p (selected-window))
+    ;;         (bury-buffer)))
+    ;;   (select-window owindow))
     (quail-delete-region)
-    (quail-choose-completion-string choice buffer base-size)
+    (setq quail-current-str choice)
+    ;; FIXME: We need to pass `base-position' here.
+    ;; FIXME: why do we need choose-completion-string with all its
+    ;; completion-specific logic?
+    (choose-completion-string choice buffer)
     (quail-terminate-translation)))
 
-;; BASE-SIZE here is for compatibility with an (unused) arg of a
-;; previous implementation.
-(defun quail-choose-completion-string (choice &optional buffer base-size)
-  (setq quail-current-str choice)
-  ;; FIXME: We need to pass `base-position' here.
-  (choose-completion-string choice buffer))
-
 (defun quail-build-decode-map (map-list key decode-map num
                                        &optional maxnum ignores)
   "Build a decoding map.

=== modified file 'lisp/mail/sendmail.el'
--- a/lisp/mail/sendmail.el     2011-05-27 07:18:15 +0000
+++ b/lisp/mail/sendmail.el     2011-06-01 19:32:04 +0000
@@ -470,7 +470,8 @@
 
 (put 'mail-mailer-swallows-blank-line 'risky-local-variable t) ; gets evalled
 (make-obsolete-variable 'mail-mailer-swallows-blank-line
-                       "no need to set this on any modern system." "24.1")
+                       "no need to set this on any modern system."
+                        "24.1" 'set)
 
 (defvar mail-mode-syntax-table
   ;; define-derived-mode will make it inherit from text-mode-syntax-table.

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-06-01 15:34:41 +0000
+++ b/lisp/minibuffer.el        2011-06-01 19:32:04 +0000
@@ -1974,7 +1974,11 @@
 ;; minibuffer-completing-file-name is a variable used internally in minibuf.c
 ;; to determine whether to use minibuffer-local-filename-completion-map or
 ;; minibuffer-local-completion-map.  It shouldn't be exported to Elisp.
-(make-obsolete-variable 'minibuffer-completing-file-name nil "24.1")
+;; FIXME: Actually, it is also used in rfn-eshadow.el we'd otherwise have to
+;; use (eq minibuffer-completion-table #'read-file-name-internal), which is
+;; probably even worse.  Maybe We should add some read-file-name-setup-hook
+;; instead, but for now, let's keep this non-obsolete.
+;;(make-obsolete-variable 'minibuffer-completing-file-name nil "24.1" 'get)
 
 (defun read-file-name-default (prompt &optional dir default-filename mustmatch 
initial predicate)
   "Default method for reading file names.

=== modified file 'lisp/proced.el'
--- a/lisp/proced.el    2011-04-19 13:44:55 +0000
+++ b/lisp/proced.el    2011-06-01 19:32:04 +0000
@@ -1735,8 +1735,9 @@
                    (pnum (if (= 1 (length process-alist))
                              "1 process"
                            (format "%d processes" (length process-alist))))
-                   (completion-annotate-function
-                    (lambda (s) (cdr (assoc s proced-signal-list)))))
+                   (completion-extra-properties
+                    '(:annotation-function
+                      (lambda (s) (cdr (assoc s proced-signal-list))))))
               (setq signal
                     (completing-read (concat "Send signal [" pnum
                                              "] (default TERM): ")

=== modified file 'lisp/server.el'
--- a/lisp/server.el    2011-05-02 02:33:11 +0000
+++ b/lisp/server.el    2011-06-01 19:32:04 +0000
@@ -235,9 +235,10 @@
 (defun server-clients-with (property value)
   "Return a list of clients with PROPERTY set to VALUE."
   (let (result)
-    (dolist (proc server-clients result)
+    (dolist (proc server-clients)
       (when (equal value (process-get proc property))
-       (push proc result)))))
+       (push proc result)))
+    result))
 
 (defun server-add-client (proc)
   "Create a client for process PROC, if it doesn't already have one.
@@ -1322,10 +1323,11 @@
   "Ask before killing a server buffer."
   (or (not server-buffer-clients)
       (let ((res t))
-       (dolist (proc server-buffer-clients res)
+       (dolist (proc server-buffer-clients)
           (when (and (memq proc server-clients)
                      (eq (process-status proc) 'open))
-            (setq res nil))))
+            (setq res nil)))
+         res)
       (yes-or-no-p (format "Buffer `%s' still has clients; kill it? "
                           (buffer-name (current-buffer))))))
 
@@ -1333,10 +1335,11 @@
   "Ask before exiting Emacs if it has live clients."
   (or (not server-clients)
       (let (live-client)
-       (dolist (proc server-clients live-client)
+       (dolist (proc server-clients)
          (when (memq t (mapcar 'buffer-live-p (process-get
                                                proc 'buffers)))
-           (setq live-client t))))
+           (setq live-client t)))
+        live-client)
       (yes-or-no-p "This Emacs session has clients; exit anyway? ")))
 
 (defun server-kill-buffer ()

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2011-06-01 15:52:35 +0000
+++ b/lisp/simple.el    2011-06-01 19:32:04 +0000
@@ -1156,7 +1156,7 @@
 
 (defvar minibuffer-completing-symbol nil
   "Non-nil means completing a Lisp symbol in the minibuffer.")
-(make-obsolete-variable 'minibuffer-completing-symbol nil "24.1")
+(make-obsolete-variable 'minibuffer-completing-symbol nil "24.1" 'get)
 
 (defvar minibuffer-default nil
   "The current default value or list of default values in the minibuffer.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]