[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112318: * lisp/emacs-lisp/lisp.el (l
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112318: * lisp/emacs-lisp/lisp.el (lisp-completion-at-point): Provide specialized |
Date: |
Wed, 17 Apr 2013 16:52:02 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 112318
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-04-17 16:52:02 -0400
message:
* 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.
modified:
etc/NEWS
lisp/ChangeLog
lisp/emacs-lisp/lisp.el
lisp/minibuffer.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2013-04-15 17:01:00 +0000
+++ b/etc/NEWS 2013-04-17 20:52:02 +0000
@@ -323,7 +323,11 @@
* 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'.
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-04-17 18:03:46 +0000
+++ b/lisp/ChangeLog 2013-04-17 20:52:02 +0000
@@ -1,13 +1,22 @@
+2013-04-17 Stefan Monnier <address@hidden>
+
+ * 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 <address@hidden>
- * 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 <address@hidden> (tiny change)
=== modified file 'lisp/emacs-lisp/lisp.el'
--- a/lisp/emacs-lisp/lisp.el 2013-01-01 09:11:05 +0000
+++ b/lisp/emacs-lisp/lisp.el 2013-04-17 20:52:02 +0000
@@ -46,6 +46,12 @@
: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 @@
;; "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 @@
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 @@
(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 @@
(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
=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el 2013-04-16 02:41:37 +0000
+++ b/lisp/minibuffer.el 2013-04-17 20:52:02 +0000
@@ -638,7 +638,8 @@
(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 ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112318: * lisp/emacs-lisp/lisp.el (lisp-completion-at-point): Provide specialized,
Stefan Monnier <=