* lisp/emacs-lisp/lisp.el (lisp-completion-at-point): Provide specialized
completion tables when completing error conditions and `declare' arguments. (lisp-complete-symbol, field-complete): Mark as obsolete. (check-parens): Unmatched parens are user errors. * lisp/minibuffer.el (minibuffer-completion-contents): Mark as obsolete.
This commit is contained in:
parent
ffe54a139d
commit
dd8791e96f
4 changed files with 78 additions and 36 deletions
6
etc/NEWS
6
etc/NEWS
|
@ -323,7 +323,11 @@ file using `set-file-extended-attributes'.
|
|||
|
||||
* Lisp Changes in Emacs 24.4
|
||||
|
||||
** `dont-compile' is declared obsolete.
|
||||
** Obsoleted functions:
|
||||
*** `dont-compile'
|
||||
*** `lisp-complete-symbol'
|
||||
*** `field-complete'
|
||||
*** `minibuffer-completion-contents'
|
||||
|
||||
** `get-upcase-table' is obsoleted by the new `case-table-get-table'.
|
||||
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
2013-04-17 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/lisp.el (lisp-completion-at-point): Provide specialized
|
||||
completion tables when completing error conditions and
|
||||
`declare' arguments.
|
||||
(lisp-complete-symbol, field-complete): Mark as obsolete.
|
||||
(check-parens): Unmatched parens are user errors.
|
||||
* minibuffer.el (minibuffer-completion-contents): Mark as obsolete.
|
||||
|
||||
2013-04-17 Michal Nazarewicz <mina86@mina86.com>
|
||||
|
||||
* textmodes/flyspell.el (flyspell-check-pre-word-p): Return nil if
|
||||
command changed buffer (ie. `flyspell-pre-buffer' is not current
|
||||
buffer), which prevents making decisions based on invalid value of
|
||||
`flyspell-pre-point' in the wrong buffer. Most notably, this used to
|
||||
cause an error when `flyspell-pre-point' was nil after switching
|
||||
buffers
|
||||
(flyspell-post-command-hook): No longer needs to change buffers when
|
||||
checking pre-word. While at it remove unnecessary progn.
|
||||
* textmodes/flyspell.el (flyspell-check-pre-word-p): Return nil if
|
||||
command changed buffer (ie. `flyspell-pre-buffer' is not current
|
||||
buffer), which prevents making decisions based on invalid value of
|
||||
`flyspell-pre-point' in the wrong buffer. Most notably, this used to
|
||||
cause an error when `flyspell-pre-point' was nil after switching
|
||||
buffers.
|
||||
(flyspell-post-command-hook): No longer needs to change buffers when
|
||||
checking pre-word. While at it remove unnecessary progn.
|
||||
|
||||
2013-04-17 Nicolas Richard <theonewiththeevillook@yahoo.fr> (tiny change)
|
||||
|
||||
|
|
|
@ -46,6 +46,12 @@ This affects `insert-parentheses' and `insert-pair'."
|
|||
:group 'lisp)
|
||||
|
||||
(defvar forward-sexp-function nil
|
||||
;; FIXME:
|
||||
;; - for some uses, we may want a "sexp-only" version, which only
|
||||
;; jumps over a well-formed sexp, rather than some dwimish thing
|
||||
;; like jumping from an "else" back up to its "if".
|
||||
;; - for up-list, we could use the "sexp-only" behavior as well
|
||||
;; to treat the dwimish halfsexp as a form of "up-list" step.
|
||||
"If non-nil, `forward-sexp' delegates to this function.
|
||||
Should take the same arguments and behave similarly to `forward-sexp'.")
|
||||
|
||||
|
@ -618,9 +624,10 @@ character."
|
|||
;; "Unbalanced parentheses", but those may not be so
|
||||
;; accurate/helpful, e.g. quotes may actually be
|
||||
;; mismatched.
|
||||
(error "Unmatched bracket or quote"))))
|
||||
(user-error "Unmatched bracket or quote"))))
|
||||
|
||||
(defun field-complete (table &optional predicate)
|
||||
(declare (obsolete completion-in-region "24.4"))
|
||||
(let ((minibuffer-completion-table table)
|
||||
(minibuffer-completion-predicate predicate)
|
||||
;; This made sense for lisp-complete-symbol, but for
|
||||
|
@ -645,6 +652,7 @@ considered. If the symbol starts just after an open-parenthesis, only
|
|||
symbols with function definitions are considered. Otherwise, all
|
||||
symbols with function definitions, values or properties are
|
||||
considered."
|
||||
(declare (obsolete completion-at-point "24.4"))
|
||||
(interactive)
|
||||
(let* ((data (lisp-completion-at-point predicate))
|
||||
(plist (nthcdr 3 data)))
|
||||
|
@ -666,25 +674,6 @@ considered."
|
|||
(skip-syntax-forward "'")
|
||||
(point))
|
||||
(scan-error pos)))
|
||||
(predicate
|
||||
(or predicate
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(if (not (eq (char-before) ?\())
|
||||
(lambda (sym) ;why not just nil ? -sm
|
||||
(or (boundp sym) (fboundp sym)
|
||||
(symbol-plist sym)))
|
||||
;; Looks like a funcall position. Let's double check.
|
||||
(if (condition-case nil
|
||||
(progn (up-list -2) (forward-char 1)
|
||||
(eq (char-after) ?\())
|
||||
(error nil))
|
||||
;; If the first element of the parent list is an open
|
||||
;; paren we are probably not in a funcall position.
|
||||
;; Maybe a `let' varlist or something.
|
||||
nil
|
||||
;; Else, we assume that a function name is expected.
|
||||
'fboundp)))))
|
||||
(end
|
||||
(unless (or (eq beg (point-max))
|
||||
(member (char-syntax (char-after beg)) '(?\" ?\( ?\))))
|
||||
|
@ -694,12 +683,51 @@ considered."
|
|||
(forward-sexp 1)
|
||||
(when (>= (point) pos)
|
||||
(point)))
|
||||
(scan-error pos)))))
|
||||
(scan-error pos))))
|
||||
(funpos (eq (char-before beg) ?\()) ;t if in function position.
|
||||
(table-etc
|
||||
(if (not funpos)
|
||||
;; FIXME: We could look at the first element of the list and
|
||||
;; use it to provide a more specific completion table in some
|
||||
;; cases. E.g. filter out keywords that are not understood by
|
||||
;; the macro/function being called.
|
||||
(list nil obarray ;Could be anything.
|
||||
:annotation-function
|
||||
(lambda (str) (if (fboundp (intern-soft str)) " <f>")))
|
||||
;; Looks like a funcall position. Let's double check.
|
||||
(save-excursion
|
||||
(goto-char (1- beg))
|
||||
(let ((parent
|
||||
(condition-case nil
|
||||
(progn (up-list -1) (forward-char 1)
|
||||
(let ((c (char-after)))
|
||||
(if (eq c ?\() ?\(
|
||||
(if (memq (char-syntax c) '(?w ?_))
|
||||
(read (current-buffer))))))
|
||||
(error nil))))
|
||||
(pcase parent
|
||||
;; FIXME: Rather than hardcode special cases here,
|
||||
;; we should use something like a symbol-property.
|
||||
(`declare
|
||||
(list t (mapcar (lambda (x) (symbol-name (car x)))
|
||||
(delete-dups
|
||||
(append
|
||||
macro-declarations-alist
|
||||
defun-declarations-alist)))))
|
||||
((or `condition-case `condition-case-unless-debug)
|
||||
(list t obarray
|
||||
:predicate (lambda (sym) (get sym 'error-conditions))))
|
||||
(_ (list nil obarray #'fboundp))))))))
|
||||
(when end
|
||||
(list beg end obarray
|
||||
:predicate predicate
|
||||
:annotation-function
|
||||
(unless (eq predicate 'fboundp)
|
||||
(lambda (str) (if (fboundp (intern-soft str)) " <f>"))))))))
|
||||
(let ((tail (if (null (car table-etc))
|
||||
(cdr table-etc)
|
||||
(cons
|
||||
(if (memq (char-syntax (char-after end))
|
||||
'(?\s ?>))
|
||||
(cadr table-etc)
|
||||
(apply-partially 'completion-table-with-terminator
|
||||
" " (cadr table-etc)))
|
||||
(cddr table-etc)))))
|
||||
`(,beg ,end ,@tail))))))
|
||||
|
||||
;;; lisp.el ends here
|
||||
|
|
|
@ -638,7 +638,8 @@ If ARGS are provided, then pass MESSAGE through `format'."
|
|||
|
||||
(defun minibuffer-completion-contents ()
|
||||
"Return the user input in a minibuffer before point as a string.
|
||||
That is what completion commands operate on."
|
||||
That used to be what completion commands operate on."
|
||||
(declare (obsolete minibuffer-contents "24.4"))
|
||||
(buffer-substring (field-beginning) (point)))
|
||||
|
||||
(defun delete-minibuffer-contents ()
|
||||
|
|
Loading…
Add table
Reference in a new issue