aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2015-03-16 14:49:01 -0400
committerStefan Monnier2015-03-16 14:49:01 -0400
commitf925fc93bac41d7622d1af927e33b0e738ff55b0 (patch)
treee8635662256290a1662a299b66e32f6301535200
parent43a847c02c3eb848cd0d55a4722bfe7f39b1112f (diff)
downloademacs-f925fc93bac41d7622d1af927e33b0e738ff55b0.tar.gz
emacs-f925fc93bac41d7622d1af927e33b0e738ff55b0.zip
Add `predicate' arg to `read-buffer' and use it for erc-iswitchb
Fixes: debbugs:20116 * src/minibuf.c (Fread_buffer): Add `predicate' argument. * src/callint.c (Fcall_interactively): Adjust calls accordingly. * lisp/erc/erc.el (erc-switch-to-buffer): Rename from erc-iswitchb and rewrite using read-buffer. (erc--buffer-p): New function, extracted from erc-buffer-filter. (erc-buffer-filter): Use it. (erc-with-all-buffers-of-server): Silence compile warning if the return value is unused. (erc-is-valid-nick-p, erc-common-server-suffixes, erc-get-arglist) (erc-command-name, erc-popup-input-buffer): Use \` and \' to match beg/end of string. * lisp/obsolete/iswitchb.el (iswitchb-read-buffer): Add `predicate' arg. * lisp/isearchb.el (isearchb-iswitchb): Adjust accordingly. * lisp/ido.el (ido-read-buffer): Add `predicate' argument. * lisp/misearch.el (unload-function-defs-list): Declare before use.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emulation/viper-init.el2
-rw-r--r--lisp/erc/ChangeLog12
-rw-r--r--lisp/erc/erc.el99
-rw-r--r--lisp/ido.el8
-rw-r--r--lisp/isearchb.el6
-rw-r--r--lisp/misearch.el4
-rw-r--r--lisp/obsolete/iswitchb.el6
-rw-r--r--lisp/replace.el2
-rw-r--r--src/ChangeLog5
-rw-r--r--src/callint.c4
-rw-r--r--src/minibuf.c18
13 files changed, 105 insertions, 72 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 24ed0799b2c..cabd0087d92 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -594,6 +594,8 @@ a typographically-correct documents.
594 594
595* Incompatible Lisp Changes in Emacs 25.1 595* Incompatible Lisp Changes in Emacs 25.1
596 596
597** read-buffer-function can now be called with a 4th argument (`predicate').
598
597** completion-table-dynamic stays in the minibuffer. 599** completion-table-dynamic stays in the minibuffer.
598If you want the old behavior of calling the function in the buffer 600If you want the old behavior of calling the function in the buffer
599from which the minibuffer was entered, call it with the new argument 601from which the minibuffer was entered, call it with the new argument
@@ -631,6 +633,8 @@ word syntax, use `\sw' instead.
631 633
632* Lisp Changes in Emacs 25.1 634* Lisp Changes in Emacs 25.1
633 635
636** `read-buffer' takes a new `predicate' argument.
637
634** Emacs Lisp now supports generators. 638** Emacs Lisp now supports generators.
635 639
636** New finalizer facility for running code when objects 640** New finalizer facility for running code when objects
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1383fdb2ecf..e9e910a8857 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12015-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * obsolete/iswitchb.el (iswitchb-read-buffer): Add `predicate' arg.
4 * isearchb.el (isearchb-iswitchb): Adjust accordingly.
5 * ido.el (ido-read-buffer): Add `predicate' argument.
6 * misearch.el (unload-function-defs-list): Declare before use.
7
12015-03-16 Vibhav Pant <vibhavp@gmail.com> 82015-03-16 Vibhav Pant <vibhavp@gmail.com>
2 9
3 * net/browse-url.el (browse-url-browser-function): Add "Conkeror". 10 * net/browse-url.el (browse-url-browser-function): Add "Conkeror".
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 75932a80d44..e575eee6c93 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -463,7 +463,7 @@ color displays. By default, the delimiters are used only on TTYs."
463 :type 'boolean 463 :type 'boolean
464 :group 'viper) 464 :group 'viper)
465 465
466(defcustom viper-read-buffer-function 'read-buffer 466(defcustom viper-read-buffer-function #'read-buffer
467 "Function to use for prompting the user for a buffer name." 467 "Function to use for prompting the user for a buffer name."
468 :type 'symbol 468 :type 'symbol
469 :group 'viper) 469 :group 'viper)
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 4f5fced1bd5..e75b8cc0078 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,15 @@
12015-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * erc.el (erc-switch-to-buffer): Rename from erc-iswitchb and rewrite
4 using read-buffer (bug#20116).
5 (erc--buffer-p): New function, extracted from erc-buffer-filter.
6 (erc-buffer-filter): Use it.
7 (erc-with-all-buffers-of-server): Silence compile warning if the return
8 value is unused.
9 (erc-is-valid-nick-p, erc-common-server-suffixes, erc-get-arglist)
10 (erc-command-name, erc-popup-input-buffer): Use \` and \' to match
11 beg/end of string.
12
12015-03-03 Kelvin White <kwhite@gnu.org> 132015-03-03 Kelvin White <kwhite@gnu.org>
2 14
3 * erc.el: Add old version string back to file header for 15 * erc.el: Add old version string back to file header for
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index a84f9f07523..7e76a6def42 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1110,7 +1110,7 @@ which the local user typed."
1110 (define-key map "\C-a" 'erc-bol) 1110 (define-key map "\C-a" 'erc-bol)
1111 (define-key map [home] 'erc-bol) 1111 (define-key map [home] 'erc-bol)
1112 (define-key map "\C-c\C-a" 'erc-bol) 1112 (define-key map "\C-c\C-a" 'erc-bol)
1113 (define-key map "\C-c\C-b" 'erc-iswitchb) 1113 (define-key map "\C-c\C-b" 'erc-switch-to-buffer)
1114 (define-key map "\C-c\C-c" 'erc-toggle-interpret-controls) 1114 (define-key map "\C-c\C-c" 'erc-toggle-interpret-controls)
1115 (define-key map "\C-c\C-d" 'erc-input-action) 1115 (define-key map "\C-c\C-d" 'erc-input-action)
1116 (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse) 1116 (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse)
@@ -1647,6 +1647,14 @@ If PROC is not supplied, all processes are searched."
1647 (throw 'buffer (current-buffer))))) 1647 (throw 'buffer (current-buffer)))))
1648 proc)))) 1648 proc))))
1649 1649
1650(defun erc--buffer-p (buf predicate proc)
1651 (with-current-buffer buf
1652 (and (derived-mode-p 'erc-mode)
1653 (or (not proc)
1654 (eq proc erc-server-process))
1655 (funcall predicate)
1656 buf)))
1657
1650(defun erc-buffer-filter (predicate &optional proc) 1658(defun erc-buffer-filter (predicate &optional proc)
1651 "Return a list of `erc-mode' buffers matching certain criteria. 1659 "Return a list of `erc-mode' buffers matching certain criteria.
1652PREDICATE is a function executed with each buffer, if it returns t, that buffer 1660PREDICATE is a function executed with each buffer, if it returns t, that buffer
@@ -1659,12 +1667,7 @@ server connection, or nil which means all open connections."
1659 nil 1667 nil
1660 (mapcar (lambda (buf) 1668 (mapcar (lambda (buf)
1661 (when (buffer-live-p buf) 1669 (when (buffer-live-p buf)
1662 (with-current-buffer buf 1670 (erc--buffer-p buf predicate proc)))
1663 (and (eq major-mode 'erc-mode)
1664 (or (not proc)
1665 (eq proc erc-server-process))
1666 (funcall predicate)
1667 buf))))
1668 (buffer-list))))) 1671 (buffer-list)))))
1669 1672
1670(defun erc-buffer-list (&optional predicate proc) 1673(defun erc-buffer-list (&optional predicate proc)
@@ -1695,42 +1698,32 @@ nil."
1695 ,pro)))) 1698 ,pro))))
1696 ;; Silence the byte-compiler by binding the result of mapcar to 1699 ;; Silence the byte-compiler by binding the result of mapcar to
1697 ;; a variable. 1700 ;; a variable.
1701 (ignore res)
1698 res))) 1702 res)))
1699 1703
1700;; (iswitchb-mode) will autoload iswitchb.el 1704(define-obsolete-function-alias 'erc-iswitchb 'erc-switch-to-buffer "25.1")
1701(defvar iswitchb-temp-buflist) 1705(defun erc-switch-to-buffer (&optional arg)
1702(declare-function iswitchb-read-buffer "iswitchb" 1706 "Prompt for a ERC buffer to switch to.
1703 (prompt &optional default require-match start matches-set))
1704(defvar iswitchb-make-buflist-hook)
1705
1706(defun erc-iswitchb (&optional arg)
1707 "Use `iswitchb-read-buffer' to prompt for a ERC buffer to switch to.
1708When invoked with prefix argument, use all erc buffers. Without prefix 1707When invoked with prefix argument, use all erc buffers. Without prefix
1709ARG, allow only buffers related to same session server. 1708ARG, allow only buffers related to same session server.
1710If `erc-track-mode' is in enabled, put the last element of 1709If `erc-track-mode' is in enabled, put the last element of
1711`erc-modified-channels-alist' in front of the buffer list. 1710`erc-modified-channels-alist' in front of the buffer list."
1712
1713Due to some yet unresolved reason, global function `iswitchb-mode'
1714needs to be active for this function to work."
1715 (interactive "P") 1711 (interactive "P")
1716 (let ((enabled (bound-and-true-p iswitchb-mode))) 1712 (switch-to-buffer
1717 (or enabled (iswitchb-mode 1)) 1713 (read-buffer "Switch to ERC buffer: "
1718 (unwind-protect 1714 (when (boundp 'erc-modified-channels-alist)
1719 (let ((iswitchb-make-buflist-hook 1715 (buffer-name (caar (last erc-modified-channels-alist))))
1720 (lambda () 1716 t
1721 (setq iswitchb-temp-buflist 1717 ;; Only allow ERC buffers in the same session.
1722 (mapcar 'buffer-name 1718 (let ((proc (unless arg erc-server-process)))
1723 (erc-buffer-list 1719 (lambda (bufname)
1724 nil 1720 (let ((buf (get-buffer bufname)))
1725 (when arg erc-server-process))))))) 1721 (when buf
1726 (switch-to-buffer 1722 (erc--buffer-p buf (lambda () t) proc)
1727 (iswitchb-read-buffer 1723 (with-current-buffer buf
1728 "Switch-to: " 1724 (and (derived-mode-p 'erc-mode)
1729 (if (boundp 'erc-modified-channels-alist) 1725 (or (null proc)
1730 (buffer-name (caar (last erc-modified-channels-alist))) 1726 (eq proc erc-server-process)))))))))))
1731 nil)
1732 t)))
1733 (or enabled (iswitchb-mode -1)))))
1734 1727
1735(defun erc-channel-list (proc) 1728(defun erc-channel-list (proc)
1736 "Return a list of channel buffers. 1729 "Return a list of channel buffers.
@@ -2189,7 +2182,7 @@ be invoked for the values of the other parameters."
2189Arguments are the same as for `erc'." 2182Arguments are the same as for `erc'."
2190 (interactive (erc-select-read-args)) 2183 (interactive (erc-select-read-args))
2191 (let ((erc-server-connect-function 'erc-open-tls-stream)) 2184 (let ((erc-server-connect-function 'erc-open-tls-stream))
2192 (apply 'erc r))) 2185 (apply #'erc r)))
2193 2186
2194(defun erc-open-tls-stream (name buffer host port) 2187(defun erc-open-tls-stream (name buffer host port)
2195 "Open an TLS stream to an IRC server. 2188 "Open an TLS stream to an IRC server.
@@ -2403,7 +2396,7 @@ If STRING is nil, the function does nothing."
2403 2396
2404(defun erc-is-valid-nick-p (nick) 2397(defun erc-is-valid-nick-p (nick)
2405 "Check if NICK is a valid IRC nickname." 2398 "Check if NICK is a valid IRC nickname."
2406 (string-match (concat "^" erc-valid-nick-regexp "$") nick)) 2399 (string-match (concat "\\`" erc-valid-nick-regexp "\\'") nick))
2407 2400
2408(defun erc-display-line (string &optional buffer) 2401(defun erc-display-line (string &optional buffer)
2409 "Display STRING in the ERC BUFFER. 2402 "Display STRING in the ERC BUFFER.
@@ -2602,9 +2595,9 @@ server within `erc-lurker-threshold-time'. See also
2602 erc-lurker-threshold-time)))) 2595 erc-lurker-threshold-time))))
2603 2596
2604(defcustom erc-common-server-suffixes 2597(defcustom erc-common-server-suffixes
2605 '(("openprojects.net$" . "OPN") 2598 '(("openprojects.net\\'" . "OPN")
2606 ("freenode.net$" . "freenode") 2599 ("freenode.net\\'" . "freenode")
2607 ("oftc.net$" . "OFTC")) 2600 ("oftc.net\\'" . "OFTC"))
2608 "Alist of common server name suffixes. 2601 "Alist of common server name suffixes.
2609This variable is used in mode-line display to save screen 2602This variable is used in mode-line display to save screen
2610real estate. Set it to nil if you want to avoid changing 2603real estate. Set it to nil if you want to avoid changing
@@ -2640,7 +2633,7 @@ ARGS, PARSED, and TYPE are used to format MSG sensibly.
2640 2633
2641See also `erc-format-message' and `erc-display-line'." 2634See also `erc-format-message' and `erc-display-line'."
2642 (let ((string (if (symbolp msg) 2635 (let ((string (if (symbolp msg)
2643 (apply 'erc-format-message msg args) 2636 (apply #'erc-format-message msg args)
2644 msg))) 2637 msg)))
2645 (setq string 2638 (setq string
2646 (cond 2639 (cond
@@ -2689,7 +2682,7 @@ See also `erc-server-send'."
2689(defun erc-get-arglist (fun) 2682(defun erc-get-arglist (fun)
2690 "Return the argument list of a function without the parens." 2683 "Return the argument list of a function without the parens."
2691 (let ((arglist (format "%S" (erc-function-arglist fun)))) 2684 (let ((arglist (format "%S" (erc-function-arglist fun))))
2692 (if (string-match "^(\\(.*\\))$" arglist) 2685 (if (string-match "\\`(\\(.*\\))\\'" arglist)
2693 (match-string 1 arglist) 2686 (match-string 1 arglist)
2694 arglist))) 2687 arglist)))
2695 2688
@@ -2705,7 +2698,7 @@ is not alive, nil otherwise."
2705 "For CMD being the function name of a ERC command, something like 2698 "For CMD being the function name of a ERC command, something like
2706erc-cmd-FOO, this returns a string /FOO." 2699erc-cmd-FOO, this returns a string /FOO."
2707 (let ((command-name (symbol-name cmd))) 2700 (let ((command-name (symbol-name cmd)))
2708 (if (string-match "^erc-cmd-\\(.*\\)$" command-name) 2701 (if (string-match "\\`erc-cmd-\\(.*\\)\\'" command-name)
2709 (concat "/" (match-string 1 command-name)) 2702 (concat "/" (match-string 1 command-name))
2710 command-name))) 2703 command-name)))
2711 2704
@@ -2796,7 +2789,7 @@ VALUE is computed by evaluating the rest of LINE in Lisp."
2796 (erc-display-line 2789 (erc-display-line
2797 (concat "Available user variables:\n" 2790 (concat "Available user variables:\n"
2798 (apply 2791 (apply
2799 'concat 2792 #'concat
2800 (mapcar 2793 (mapcar
2801 (lambda (var) 2794 (lambda (var)
2802 (let ((val (symbol-value var))) 2795 (let ((val (symbol-value var)))
@@ -3775,7 +3768,7 @@ Unban all currently banned users in the current channel."
3775 t))) 3768 t)))
3776 (erc-server-send (format "MODE %s b" chnl))))) 3769 (erc-server-send (format "MODE %s b" chnl)))))
3777 3770
3778 (t (let ((bans (mapcar 'cdr erc-channel-banlist))) 3771 (t (let ((bans (mapcar #'cdr erc-channel-banlist)))
3779 (when bans 3772 (when bans
3780 ;; Glob the bans into groups of three, and carry out the unban. 3773 ;; Glob the bans into groups of three, and carry out the unban.
3781 ;; eg. /mode #foo -bbb a*!*@* b*!*@* c*!*@* 3774 ;; eg. /mode #foo -bbb a*!*@* b*!*@* c*!*@*
@@ -3930,7 +3923,7 @@ If `point' is at the beginning of a channel name, use that as default."
3930 (concat "Set topic of " (erc-default-target) ": ") 3923 (concat "Set topic of " (erc-default-target) ": ")
3931 (when erc-channel-topic 3924 (when erc-channel-topic
3932 (let ((ss (split-string erc-channel-topic "\C-o"))) 3925 (let ((ss (split-string erc-channel-topic "\C-o")))
3933 (cons (apply 'concat (if (cdr ss) (butlast ss) ss)) 3926 (cons (apply #'concat (if (cdr ss) (butlast ss) ss))
3934 0)))))) 3927 0))))))
3935 (let ((topic-list (split-string topic "\C-o"))) ; strip off the topic setter 3928 (let ((topic-list (split-string topic "\C-o"))) ; strip off the topic setter
3936 (erc-cmd-TOPIC (concat (erc-default-target) " " (car topic-list))))) 3929 (erc-cmd-TOPIC (concat (erc-default-target) " " (car topic-list)))))
@@ -5052,7 +5045,7 @@ arg-modes is a list of triples of the form:
5052 5045
5053 (MODE-CHAR ON/OFF ARGUMENT)." 5046 (MODE-CHAR ON/OFF ARGUMENT)."
5054 (if (string-match "^\\s-*\\(\\S-+\\)\\(\\s-.*$\\|$\\)" mode-string) 5047 (if (string-match "^\\s-*\\(\\S-+\\)\\(\\s-.*$\\|$\\)" mode-string)
5055 (let ((chars (mapcar 'char-to-string (match-string 1 mode-string))) 5048 (let ((chars (mapcar #'char-to-string (match-string 1 mode-string)))
5056 ;; arguments in channel modes 5049 ;; arguments in channel modes
5057 (args-str (match-string 2 mode-string)) 5050 (args-str (match-string 2 mode-string))
5058 (args nil) 5051 (args nil)
@@ -5998,7 +5991,7 @@ Returns a list of the form (HIGH LOW), compatible with Emacs time format."
5998 (if (> minutes 0) 5991 (if (> minutes 0)
5999 `("%d minutes, %d seconds" ,minutes ,seconds) 5992 `("%d minutes, %d seconds" ,minutes ,seconds)
6000 `("%d seconds" ,seconds)))) 5993 `("%d seconds" ,seconds))))
6001 output (apply 'format format-args)) 5994 output (apply #'format format-args))
6002 ;; Change all "1 units" to "1 unit". 5995 ;; Change all "1 units" to "1 unit".
6003 (while (string-match "\\([^0-9]\\|^\\)1 \\S-+\\(s\\)" output) 5996 (while (string-match "\\([^0-9]\\|^\\)1 \\S-+\\(s\\)" output)
6004 (setq output (erc-replace-match-subexpression-in-string 5997 (setq output (erc-replace-match-subexpression-in-string
@@ -6246,7 +6239,7 @@ if `erc-away' is non-nil."
6246 6239
6247(defun erc-format-channel-modes () 6240(defun erc-format-channel-modes ()
6248 "Return the current channel's modes." 6241 "Return the current channel's modes."
6249 (concat (apply 'concat 6242 (concat (apply #'concat
6250 "+" erc-channel-modes) 6243 "+" erc-channel-modes)
6251 (cond ((and erc-channel-user-limit erc-channel-key) 6244 (cond ((and erc-channel-user-limit erc-channel-key)
6252 (if erc-show-channel-key-p 6245 (if erc-show-channel-key-p
@@ -6438,7 +6431,7 @@ All windows are opened in the current frame."
6438 "Mode: " 6431 "Mode: "
6439 (mapcar (lambda (e) 6432 (mapcar (lambda (e)
6440 (list (symbol-name e))) 6433 (list (symbol-name e)))
6441 (apropos-internal "-mode$" 'commandp)) 6434 (apropos-internal "-mode\\'" 'commandp))
6442 nil t)))) 6435 nil t))))
6443 (pop-to-buffer (make-indirect-buffer (current-buffer) buffer-name)) 6436 (pop-to-buffer (make-indirect-buffer (current-buffer) buffer-name))
6444 (funcall mode) 6437 (funcall mode)
@@ -6634,7 +6627,7 @@ See also `format-spec'."
6634 (error "No format spec for message %s" msg)) 6627 (error "No format spec for message %s" msg))
6635 (when (functionp entry) 6628 (when (functionp entry)
6636 (setq entry (apply entry args))) 6629 (setq entry (apply entry args)))
6637 (format-spec entry (apply 'format-spec-make args)))) 6630 (format-spec entry (apply #'format-spec-make args))))
6638 6631
6639;;; Various hook functions 6632;;; Various hook functions
6640 6633
diff --git a/lisp/ido.el b/lisp/ido.el
index 563f406aeb6..60a59d6e99d 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1590,10 +1590,10 @@ enable the mode if ARG is omitted or nil."
1590 (when ido-everywhere 1590 (when ido-everywhere
1591 (when (memq ido-mode '(both file)) 1591 (when (memq ido-mode '(both file))
1592 (put 'ido-everywhere 'file (cons read-file-name-function nil)) 1592 (put 'ido-everywhere 'file (cons read-file-name-function nil))
1593 (setq read-file-name-function 'ido-read-file-name)) 1593 (setq read-file-name-function #'ido-read-file-name))
1594 (when (memq ido-mode '(both buffer)) 1594 (when (memq ido-mode '(both buffer))
1595 (put 'ido-everywhere 'buffer (cons read-buffer-function nil)) 1595 (put 'ido-everywhere 'buffer (cons read-buffer-function nil))
1596 (setq read-buffer-function 'ido-read-buffer)))) 1596 (setq read-buffer-function #'ido-read-buffer))))
1597 1597
1598(defvar ido-minor-mode-map-entry nil) 1598(defvar ido-minor-mode-map-entry nil)
1599 1599
@@ -4782,7 +4782,7 @@ Modified from `icomplete-completions'."
4782(put 'dired-do-rename 'ido 'ignore) 4782(put 'dired-do-rename 'ido 'ignore)
4783 4783
4784;;;###autoload 4784;;;###autoload
4785(defun ido-read-buffer (prompt &optional default require-match) 4785(defun ido-read-buffer (prompt &optional default require-match predicate)
4786 "Ido replacement for the built-in `read-buffer'. 4786 "Ido replacement for the built-in `read-buffer'.
4787Return the name of a buffer selected. 4787Return the name of a buffer selected.
4788PROMPT is the prompt to give to the user. DEFAULT if given is the default 4788PROMPT is the prompt to give to the user. DEFAULT if given is the default
@@ -4796,7 +4796,7 @@ If REQUIRE-MATCH is non-nil, an existing buffer must be selected."
4796 (if (eq ido-exit 'fallback) 4796 (if (eq ido-exit 'fallback)
4797 (let ((read-buffer-function nil)) 4797 (let ((read-buffer-function nil))
4798 (run-hook-with-args 'ido-before-fallback-functions 'read-buffer) 4798 (run-hook-with-args 'ido-before-fallback-functions 'read-buffer)
4799 (read-buffer prompt default require-match)) 4799 (read-buffer prompt default require-match predicate))
4800 buf))) 4800 buf)))
4801 4801
4802;;;###autoload 4802;;;###autoload
diff --git a/lisp/isearchb.el b/lisp/isearchb.el
index ffd4d62be38..5e7771cea52 100644
--- a/lisp/isearchb.el
+++ b/lisp/isearchb.el
@@ -75,7 +75,9 @@
75;; killing iswitchb.el and then trying to switch back is broken 75;; killing iswitchb.el and then trying to switch back is broken
76;; make sure TAB isn't broken 76;; make sure TAB isn't broken
77 77
78(require 'iswitchb) 78;;; Code:
79
80(require 'iswitchb) ;FIXME: Don't rely on iswitchb!
79 81
80(defgroup isearchb nil 82(defgroup isearchb nil
81 "Switch between buffers using a mechanism like isearch." 83 "Switch between buffers using a mechanism like isearch."
@@ -118,7 +120,7 @@ Its purpose is to pass different call arguments to
118 (interactive) 120 (interactive)
119 (let* ((prompt "iswitch ") 121 (let* ((prompt "iswitch ")
120 (iswitchb-method 'samewindow) 122 (iswitchb-method 'samewindow)
121 (buf (iswitchb-read-buffer prompt nil nil iswitchb-text t))) 123 (buf (iswitchb-read-buffer prompt nil nil nil iswitchb-text t)))
122 (if (eq iswitchb-exit 'findfile) 124 (if (eq iswitchb-exit 'findfile)
123 (call-interactively 'find-file) 125 (call-interactively 'find-file)
124 (when buf 126 (when buf
diff --git a/lisp/misearch.el b/lisp/misearch.el
index dcc819564fb..65969113d93 100644
--- a/lisp/misearch.el
+++ b/lisp/misearch.el
@@ -234,7 +234,7 @@ set in `multi-isearch-buffers' or `multi-isearch-buffers-regexp'."
234 (ido-ignore-item-temp-list bufs)) 234 (ido-ignore-item-temp-list bufs))
235 (while (not (string-equal 235 (while (not (string-equal
236 (setq buf (read-buffer 236 (setq buf (read-buffer
237 (if (eq read-buffer-function 'ido-read-buffer) 237 (if (eq read-buffer-function #'ido-read-buffer)
238 "Next buffer to search (C-j to end): " 238 "Next buffer to search (C-j to end): "
239 "Next buffer to search (RET to end): ") 239 "Next buffer to search (RET to end): ")
240 nil t)) 240 nil t))
@@ -377,6 +377,8 @@ whose file names match the specified wildcard."
377 (goto-char (if isearch-forward (point-min) (point-max))) 377 (goto-char (if isearch-forward (point-min) (point-max)))
378 (isearch-forward-regexp nil t))) 378 (isearch-forward-regexp nil t)))
379 379
380(defvar unload-function-defs-list)
381
380(defun multi-isearch-unload-function () 382(defun multi-isearch-unload-function ()
381 "Remove autoloaded variables from `unload-function-defs-list'. 383 "Remove autoloaded variables from `unload-function-defs-list'.
382Also prevent the feature from being reloaded via `isearch-mode-hook'." 384Also prevent the feature from being reloaded via `isearch-mode-hook'."
diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el
index 6b1e5347e21..111de8537d3 100644
--- a/lisp/obsolete/iswitchb.el
+++ b/lisp/obsolete/iswitchb.el
@@ -175,10 +175,10 @@
175;; iswitchb-read-buffer has been written to be a drop in replacement 175;; iswitchb-read-buffer has been written to be a drop in replacement
176;; for the normal buffer selection routine `read-buffer'. To use 176;; for the normal buffer selection routine `read-buffer'. To use
177;; iswitch for all buffer selections in Emacs, add: 177;; iswitch for all buffer selections in Emacs, add:
178;; (setq read-buffer-function 'iswitchb-read-buffer) 178;; (setq read-buffer-function #'iswitchb-read-buffer)
179;; (This variable was introduced in Emacs 20.3.) 179;; (This variable was introduced in Emacs 20.3.)
180;; XEmacs users can get the same behavior by doing: 180;; XEmacs users can get the same behavior by doing:
181;; (defalias 'read-buffer 'iswitchb-read-buffer) 181;; (defalias 'read-buffer #'iswitchb-read-buffer)
182;; since `read-buffer' is defined in lisp. 182;; since `read-buffer' is defined in lisp.
183 183
184;; Using iswitchb for other completion tasks. 184;; Using iswitchb for other completion tasks.
@@ -586,7 +586,7 @@ in a separate window.
586 )))) 586 ))))
587 587
588(defun iswitchb-read-buffer (prompt &optional default require-match 588(defun iswitchb-read-buffer (prompt &optional default require-match
589 start matches-set) 589 _predicate start matches-set)
590 "Replacement for the built-in `read-buffer'. 590 "Replacement for the built-in `read-buffer'.
591Return the name of a buffer selected. 591Return the name of a buffer selected.
592PROMPT is the prompt to give to the user. 592PROMPT is the prompt to give to the user.
diff --git a/lisp/replace.el b/lisp/replace.el
index e0636e0728c..70b86dd2016 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1369,7 +1369,7 @@ See also `multi-occur-in-matching-buffers'."
1369 (ido-ignore-item-temp-list bufs)) 1369 (ido-ignore-item-temp-list bufs))
1370 (while (not (string-equal 1370 (while (not (string-equal
1371 (setq buf (read-buffer 1371 (setq buf (read-buffer
1372 (if (eq read-buffer-function 'ido-read-buffer) 1372 (if (eq read-buffer-function #'ido-read-buffer)
1373 "Next buffer to search (C-j to end): " 1373 "Next buffer to search (C-j to end): "
1374 "Next buffer to search (RET to end): ") 1374 "Next buffer to search (RET to end): ")
1375 nil t)) 1375 nil t))
diff --git a/src/ChangeLog b/src/ChangeLog
index e328afcde8f..fbf8fb452fc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12015-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * minibuf.c (Fread_buffer): Add `predicate' argument.
4 * callint.c (Fcall_interactively): Adjust calls accordingly.
5
12015-03-15 Eli Zaretskii <eliz@gnu.org> 62015-03-15 Eli Zaretskii <eliz@gnu.org>
2 7
3 * xdisp.c (handle_invisible_prop): Fix up it->position even when 8 * xdisp.c (handle_invisible_prop): Fix up it->position even when
diff --git a/src/callint.c b/src/callint.c
index 0c6c03036c8..cf50e0c3788 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -531,13 +531,13 @@ invoke it. If KEYS is omitted or nil, the return value of
531 args[i] = Fcurrent_buffer (); 531 args[i] = Fcurrent_buffer ();
532 if (EQ (selected_window, minibuf_window)) 532 if (EQ (selected_window, minibuf_window))
533 args[i] = Fother_buffer (args[i], Qnil, Qnil); 533 args[i] = Fother_buffer (args[i], Qnil, Qnil);
534 args[i] = Fread_buffer (callint_message, args[i], Qt); 534 args[i] = Fread_buffer (callint_message, args[i], Qt, Qnil);
535 break; 535 break;
536 536
537 case 'B': /* Name of buffer, possibly nonexistent. */ 537 case 'B': /* Name of buffer, possibly nonexistent. */
538 args[i] = Fread_buffer (callint_message, 538 args[i] = Fread_buffer (callint_message,
539 Fother_buffer (Fcurrent_buffer (), Qnil, Qnil), 539 Fother_buffer (Fcurrent_buffer (), Qnil, Qnil),
540 Qnil); 540 Qnil, Qnil);
541 break; 541 break;
542 542
543 case 'c': /* Character. */ 543 case 'c': /* Character. */
diff --git a/src/minibuf.c b/src/minibuf.c
index e7c288b251b..c03316965d3 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1081,7 +1081,7 @@ A user option, or customizable variable, is one for which
1081 return Fintern (name, Qnil); 1081 return Fintern (name, Qnil);
1082} 1082}
1083 1083
1084DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0, 1084DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 4, 0,
1085 doc: /* Read the name of a buffer and return as a string. 1085 doc: /* Read the name of a buffer and return as a string.
1086Prompt with PROMPT. 1086Prompt with PROMPT.
1087Optional second arg DEF is value to return if user enters an empty line. 1087Optional second arg DEF is value to return if user enters an empty line.
@@ -1093,8 +1093,11 @@ The argument PROMPT should be a string ending with a colon and a space.
1093If `read-buffer-completion-ignore-case' is non-nil, completion ignores 1093If `read-buffer-completion-ignore-case' is non-nil, completion ignores
1094case while reading the buffer name. 1094case while reading the buffer name.
1095If `read-buffer-function' is non-nil, this works by calling it as a 1095If `read-buffer-function' is non-nil, this works by calling it as a
1096function, instead of the usual behavior. */) 1096function, instead of the usual behavior.
1097 (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match) 1097Optional arg PREDICATE if non-nil is a function limiting the buffers that can
1098be considered. */)
1099 (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match,
1100 Lisp_Object predicate)
1098{ 1101{
1099 Lisp_Object result; 1102 Lisp_Object result;
1100 char *s; 1103 char *s;
@@ -1136,11 +1139,16 @@ function, instead of the usual behavior. */)
1136 } 1139 }
1137 1140
1138 result = Fcompleting_read (prompt, intern ("internal-complete-buffer"), 1141 result = Fcompleting_read (prompt, intern ("internal-complete-buffer"),
1139 Qnil, require_match, Qnil, 1142 predicate, require_match, Qnil,
1140 Qbuffer_name_history, def, Qnil); 1143 Qbuffer_name_history, def, Qnil);
1141 } 1144 }
1142 else 1145 else
1143 result = call3 (Vread_buffer_function, prompt, def, require_match); 1146 result = (NILP (predicate)
1147 /* Partial backward compatibility for older read_buffer_functions
1148 which don't expect a `predicate' argument. */
1149 ? call3 (Vread_buffer_function, prompt, def, require_match)
1150 : call4 (Vread_buffer_function, prompt, def, require_match,
1151 predicate));
1144 return unbind_to (count, result); 1152 return unbind_to (count, result);
1145} 1153}
1146 1154