]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/lisp.el
Doc fix for insert-pair-alist
[gnu-emacs] / lisp / emacs-lisp / lisp.el
index 214bed7622dfd8ce40f16ddf7d9068d53a686ec9..ea7cce67be71e242c20db9bbf8718d1f71d777ee 100644 (file)
@@ -1,6 +1,6 @@
 ;;; lisp.el --- Lisp editing commands for Emacs  -*- lexical-binding:t -*-
 
 ;;; lisp.el --- Lisp editing commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1994, 2000-2015 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1994, 2000-2016 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -263,7 +263,7 @@ This command assumes point is not in a string or comment."
           (backward-up-list arg)
           (kill-sexp)
           (insert current-sexp))
           (backward-up-list arg)
           (kill-sexp)
           (insert current-sexp))
-      (error "Not at a sexp"))))
+      (user-error "Not at a sexp"))))
 \f
 (defvar beginning-of-defun-function nil
   "If non-nil, function for `beginning-of-defun-raw' to call.
 \f
 (defvar beginning-of-defun-function nil
   "If non-nil, function for `beginning-of-defun-raw' to call.
@@ -364,8 +364,7 @@ is called as a function to find the defun's beginning."
          (arg-+ve (> arg 0)))
       (save-restriction
        (widen)
          (arg-+ve (> arg 0)))
       (save-restriction
        (widen)
-       (let ((ppss (let (syntax-begin-function
-                         font-lock-beginning-of-syntax-function)
+       (let ((ppss (let (syntax-begin-function)
                      (syntax-ppss)))
              ;; position of least enclosing paren, or nil.
              encl-pos)
                      (syntax-ppss)))
              ;; position of least enclosing paren, or nil.
              encl-pos)
@@ -588,7 +587,11 @@ Interactively, the behavior depends on `narrow-to-defun-include-comments'."
 Each element looks like (OPEN-CHAR CLOSE-CHAR) or (COMMAND-CHAR
 OPEN-CHAR CLOSE-CHAR).  The characters OPEN-CHAR and CLOSE-CHAR
 of the pair whose key is equal to the last input character with
 Each element looks like (OPEN-CHAR CLOSE-CHAR) or (COMMAND-CHAR
 OPEN-CHAR CLOSE-CHAR).  The characters OPEN-CHAR and CLOSE-CHAR
 of the pair whose key is equal to the last input character with
-or without modifiers, are inserted by `insert-pair'.")
+or without modifiers, are inserted by `insert-pair'.
+
+If COMMAND-CHAR is specified, it is a character that triggers the
+insertion of the open/close pair, and COMMAND-CHAR itself isn't
+inserted.")
 
 (defun insert-pair (&optional arg open close)
   "Enclose following ARG sexps in a pair of OPEN and CLOSE characters.
 
 (defun insert-pair (&optional arg open close)
   "Enclose following ARG sexps in a pair of OPEN and CLOSE characters.
@@ -619,8 +622,11 @@ This command assumes point is not in a string or comment."
   (if (and open close)
       (if (and transient-mark-mode mark-active)
           (progn
   (if (and open close)
       (if (and transient-mark-mode mark-active)
           (progn
-            (save-excursion (goto-char (region-end))       (insert close))
-            (save-excursion (goto-char (region-beginning)) (insert open)))
+            (save-excursion
+              (goto-char (region-end))
+              (insert close))
+            (goto-char (region-beginning))
+            (insert open))
         (if arg (setq arg (prefix-numeric-value arg))
           (setq arg 0))
         (cond ((> arg 0) (skip-chars-forward " \t"))
         (if arg (setq arg (prefix-numeric-value arg))
           (setq arg 0))
         (cond ((> arg 0) (skip-chars-forward " \t"))
@@ -714,7 +720,8 @@ character."
   (condition-case data
       ;; Buffer can't have more than (point-max) sexps.
       (scan-sexps (point-min) (point-max))
   (condition-case data
       ;; Buffer can't have more than (point-max) sexps.
       (scan-sexps (point-min) (point-max))
-    (scan-error (goto-char (nth 2 data))
+    (scan-error (push-mark)
+               (goto-char (nth 2 data))
                ;; Could print (nth 1 data), which is either
                ;; "Containing expression ends prematurely" or
                ;; "Unbalanced parentheses", but those may not be so
                ;; Could print (nth 1 data), which is either
                ;; "Containing expression ends prematurely" or
                ;; "Unbalanced parentheses", but those may not be so
@@ -735,22 +742,20 @@ character."
         )
     (call-interactively 'minibuffer-complete)))
 
         )
     (call-interactively 'minibuffer-complete)))
 
-(defun lisp-complete-symbol (&optional predicate)
+(defun lisp-complete-symbol (&optional _predicate)
   "Perform completion on Lisp symbol preceding point.
 Compare that symbol against the known Lisp symbols.
 If no characters can be completed, display a list of possible completions.
 Repeating the command at that point scrolls the list.
 
   "Perform completion on Lisp symbol preceding point.
 Compare that symbol against the known Lisp symbols.
 If no characters can be completed, display a list of possible completions.
 Repeating the command at that point scrolls the list.
 
-When called from a program, optional arg PREDICATE is a predicate
-determining which symbols are considered, e.g. `commandp'.
-If PREDICATE is nil, the context determines which symbols are
-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"))
+The context determines which symbols are 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")
+           (advertised-calling-convention () "25.1"))
   (interactive)
   (interactive)
-  (let* ((data (lisp-completion-at-point predicate))
+  (let* ((data (elisp-completion-at-point))
          (plist (nthcdr 3 data)))
     (if (null data)
         (minibuffer-message "Nothing to complete")
          (plist (nthcdr 3 data)))
     (if (null data)
         (minibuffer-message "Nothing to complete")