aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-04-17 16:52:02 -0400
committerStefan Monnier2013-04-17 16:52:02 -0400
commitdd8791e96feb4915c895a4879deee67e672e0a7f (patch)
tree792850fb6f8dbd3a0af60e761d3bd7fbef972291
parentffe54a139dddefdfd3f0837281ebb62d7cc0a912 (diff)
downloademacs-dd8791e96feb4915c895a4879deee67e672e0a7f.tar.gz
emacs-dd8791e96feb4915c895a4879deee67e672e0a7f.zip
* 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.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog25
-rw-r--r--lisp/emacs-lisp/lisp.el80
-rw-r--r--lisp/minibuffer.el3
4 files changed, 78 insertions, 36 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 0830a7be469..5bf0cb302ff 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -323,7 +323,11 @@ file using `set-file-extended-attributes'.
323 323
324* Lisp Changes in Emacs 24.4 324* Lisp Changes in Emacs 24.4
325 325
326** `dont-compile' is declared obsolete. 326** Obsoleted functions:
327*** `dont-compile'
328*** `lisp-complete-symbol'
329*** `field-complete'
330*** `minibuffer-completion-contents'
327 331
328** `get-upcase-table' is obsoleted by the new `case-table-get-table'. 332** `get-upcase-table' is obsoleted by the new `case-table-get-table'.
329 333
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ffa0c840554..4ace42afa09 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,13 +1,22 @@
12013-04-17 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/lisp.el (lisp-completion-at-point): Provide specialized
4 completion tables when completing error conditions and
5 `declare' arguments.
6 (lisp-complete-symbol, field-complete): Mark as obsolete.
7 (check-parens): Unmatched parens are user errors.
8 * minibuffer.el (minibuffer-completion-contents): Mark as obsolete.
9
12013-04-17 Michal Nazarewicz <mina86@mina86.com> 102013-04-17 Michal Nazarewicz <mina86@mina86.com>
2 11
3 * textmodes/flyspell.el (flyspell-check-pre-word-p): Return nil if 12 * textmodes/flyspell.el (flyspell-check-pre-word-p): Return nil if
4 command changed buffer (ie. `flyspell-pre-buffer' is not current 13 command changed buffer (ie. `flyspell-pre-buffer' is not current
5 buffer), which prevents making decisions based on invalid value of 14 buffer), which prevents making decisions based on invalid value of
6 `flyspell-pre-point' in the wrong buffer. Most notably, this used to 15 `flyspell-pre-point' in the wrong buffer. Most notably, this used to
7 cause an error when `flyspell-pre-point' was nil after switching 16 cause an error when `flyspell-pre-point' was nil after switching
8 buffers 17 buffers.
9 (flyspell-post-command-hook): No longer needs to change buffers when 18 (flyspell-post-command-hook): No longer needs to change buffers when
10 checking pre-word. While at it remove unnecessary progn. 19 checking pre-word. While at it remove unnecessary progn.
11 20
122013-04-17 Nicolas Richard <theonewiththeevillook@yahoo.fr> (tiny change) 212013-04-17 Nicolas Richard <theonewiththeevillook@yahoo.fr> (tiny change)
13 22
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 22fb6ad1809..f301a1875ed 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -46,6 +46,12 @@ This affects `insert-parentheses' and `insert-pair'."
46 :group 'lisp) 46 :group 'lisp)
47 47
48(defvar forward-sexp-function nil 48(defvar forward-sexp-function nil
49 ;; FIXME:
50 ;; - for some uses, we may want a "sexp-only" version, which only
51 ;; jumps over a well-formed sexp, rather than some dwimish thing
52 ;; like jumping from an "else" back up to its "if".
53 ;; - for up-list, we could use the "sexp-only" behavior as well
54 ;; to treat the dwimish halfsexp as a form of "up-list" step.
49 "If non-nil, `forward-sexp' delegates to this function. 55 "If non-nil, `forward-sexp' delegates to this function.
50Should take the same arguments and behave similarly to `forward-sexp'.") 56Should take the same arguments and behave similarly to `forward-sexp'.")
51 57
@@ -618,9 +624,10 @@ character."
618 ;; "Unbalanced parentheses", but those may not be so 624 ;; "Unbalanced parentheses", but those may not be so
619 ;; accurate/helpful, e.g. quotes may actually be 625 ;; accurate/helpful, e.g. quotes may actually be
620 ;; mismatched. 626 ;; mismatched.
621 (error "Unmatched bracket or quote")))) 627 (user-error "Unmatched bracket or quote"))))
622 628
623(defun field-complete (table &optional predicate) 629(defun field-complete (table &optional predicate)
630 (declare (obsolete completion-in-region "24.4"))
624 (let ((minibuffer-completion-table table) 631 (let ((minibuffer-completion-table table)
625 (minibuffer-completion-predicate predicate) 632 (minibuffer-completion-predicate predicate)
626 ;; This made sense for lisp-complete-symbol, but for 633 ;; This made sense for lisp-complete-symbol, but for
@@ -645,6 +652,7 @@ considered. If the symbol starts just after an open-parenthesis, only
645symbols with function definitions are considered. Otherwise, all 652symbols with function definitions are considered. Otherwise, all
646symbols with function definitions, values or properties are 653symbols with function definitions, values or properties are
647considered." 654considered."
655 (declare (obsolete completion-at-point "24.4"))
648 (interactive) 656 (interactive)
649 (let* ((data (lisp-completion-at-point predicate)) 657 (let* ((data (lisp-completion-at-point predicate))
650 (plist (nthcdr 3 data))) 658 (plist (nthcdr 3 data)))
@@ -666,25 +674,6 @@ considered."
666 (skip-syntax-forward "'") 674 (skip-syntax-forward "'")
667 (point)) 675 (point))
668 (scan-error pos))) 676 (scan-error pos)))
669 (predicate
670 (or predicate
671 (save-excursion
672 (goto-char beg)
673 (if (not (eq (char-before) ?\())
674 (lambda (sym) ;why not just nil ? -sm
675 (or (boundp sym) (fboundp sym)
676 (symbol-plist sym)))
677 ;; Looks like a funcall position. Let's double check.
678 (if (condition-case nil
679 (progn (up-list -2) (forward-char 1)
680 (eq (char-after) ?\())
681 (error nil))
682 ;; If the first element of the parent list is an open
683 ;; paren we are probably not in a funcall position.
684 ;; Maybe a `let' varlist or something.
685 nil
686 ;; Else, we assume that a function name is expected.
687 'fboundp)))))
688 (end 677 (end
689 (unless (or (eq beg (point-max)) 678 (unless (or (eq beg (point-max))
690 (member (char-syntax (char-after beg)) '(?\" ?\( ?\)))) 679 (member (char-syntax (char-after beg)) '(?\" ?\( ?\))))
@@ -694,12 +683,51 @@ considered."
694 (forward-sexp 1) 683 (forward-sexp 1)
695 (when (>= (point) pos) 684 (when (>= (point) pos)
696 (point))) 685 (point)))
697 (scan-error pos))))) 686 (scan-error pos))))
687 (funpos (eq (char-before beg) ?\()) ;t if in function position.
688 (table-etc
689 (if (not funpos)
690 ;; FIXME: We could look at the first element of the list and
691 ;; use it to provide a more specific completion table in some
692 ;; cases. E.g. filter out keywords that are not understood by
693 ;; the macro/function being called.
694 (list nil obarray ;Could be anything.
695 :annotation-function
696 (lambda (str) (if (fboundp (intern-soft str)) " <f>")))
697 ;; Looks like a funcall position. Let's double check.
698 (save-excursion
699 (goto-char (1- beg))
700 (let ((parent
701 (condition-case nil
702 (progn (up-list -1) (forward-char 1)
703 (let ((c (char-after)))
704 (if (eq c ?\() ?\(
705 (if (memq (char-syntax c) '(?w ?_))
706 (read (current-buffer))))))
707 (error nil))))
708 (pcase parent
709 ;; FIXME: Rather than hardcode special cases here,
710 ;; we should use something like a symbol-property.
711 (`declare
712 (list t (mapcar (lambda (x) (symbol-name (car x)))
713 (delete-dups
714 (append
715 macro-declarations-alist
716 defun-declarations-alist)))))
717 ((or `condition-case `condition-case-unless-debug)
718 (list t obarray
719 :predicate (lambda (sym) (get sym 'error-conditions))))
720 (_ (list nil obarray #'fboundp))))))))
698 (when end 721 (when end
699 (list beg end obarray 722 (let ((tail (if (null (car table-etc))
700 :predicate predicate 723 (cdr table-etc)
701 :annotation-function 724 (cons
702 (unless (eq predicate 'fboundp) 725 (if (memq (char-syntax (char-after end))
703 (lambda (str) (if (fboundp (intern-soft str)) " <f>")))))))) 726 '(?\s ?>))
727 (cadr table-etc)
728 (apply-partially 'completion-table-with-terminator
729 " " (cadr table-etc)))
730 (cddr table-etc)))))
731 `(,beg ,end ,@tail))))))
704 732
705;;; lisp.el ends here 733;;; lisp.el ends here
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 06ac7a91bea..64e816cef38 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -638,7 +638,8 @@ If ARGS are provided, then pass MESSAGE through `format'."
638 638
639(defun minibuffer-completion-contents () 639(defun minibuffer-completion-contents ()
640 "Return the user input in a minibuffer before point as a string. 640 "Return the user input in a minibuffer before point as a string.
641That is what completion commands operate on." 641That used to be what completion commands operate on."
642 (declare (obsolete minibuffer-contents "24.4"))
642 (buffer-substring (field-beginning) (point))) 643 (buffer-substring (field-beginning) (point)))
643 644
644(defun delete-minibuffer-contents () 645(defun delete-minibuffer-contents ()