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.
This commit is contained in:
parent
3b7d5980c9
commit
2403c841a8
12 changed files with 90 additions and 57 deletions
|
@ -1,3 +1,31 @@
|
|||
2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
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 <monnier@iro.umontreal.ca>
|
||||
|
||||
* simple.el (goto-line): Use read-number.
|
||||
|
|
|
@ -153,24 +153,21 @@ See the docstrings of `defalias' and `make-obsolete' for more details."
|
|||
'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)
|
||||
|
|
|
@ -1109,7 +1109,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
|
|||
(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 @@ That command is designed for interactive use only" fn))
|
|||
(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 @@ If BINDING is non-nil, VAR is being bound."
|
|||
|
||||
(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 @@ If BINDING is non-nil, VAR is being bound."
|
|||
|
||||
(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
|
||||
|
|
|
@ -636,9 +636,8 @@ considered."
|
|||
(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))))))
|
||||
|
||||
|
||||
|
|
|
@ -563,7 +563,7 @@ we recommend setting `syntax-begin-function' instead.
|
|||
|
||||
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.
|
||||
|
|
|
@ -805,7 +805,8 @@ it is displayed along with the global value."
|
|||
(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 ".")))
|
||||
|
|
|
@ -2253,12 +2253,10 @@ are shown (at most to the depth specified `quail-completion-max-depth')."
|
|||
;; 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 @@ are shown (at most to the depth specified `quail-completion-max-depth')."
|
|||
(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.
|
||||
|
|
|
@ -470,7 +470,8 @@ by Emacs.)")
|
|||
|
||||
(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.
|
||||
|
|
|
@ -1974,7 +1974,11 @@ and `read-file-name-function'."
|
|||
;; 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.
|
||||
|
|
|
@ -1735,8 +1735,9 @@ After sending the signal, this command runs the normal hook
|
|||
(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): ")
|
||||
|
|
|
@ -235,9 +235,10 @@ If local sockets are not supported, this is nil.")
|
|||
(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 @@ specifically for the clients and did not exist before their request for it."
|
|||
"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 @@ specifically for the clients and did not exist before their request for it."
|
|||
"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 ()
|
||||
|
|
|
@ -1156,7 +1156,7 @@ in *Help* buffer. See also the command `describe-char'."
|
|||
|
||||
(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.
|
||||
|
|
Loading…
Add table
Reference in a new issue