aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert2016-02-09 14:23:10 -0800
committerPaul Eggert2016-02-09 14:23:10 -0800
commitb3fc7a3e763fb260cd932dc6aedbe7b4c810a73c (patch)
tree72495a45c9e58f16f6b09448f6956507da6ccf89 /lisp
parentc71e7cc113ed0d5f01aaa2e441a3e3c9fbeb9fa5 (diff)
parent9ffe7ddd5e1ba93f327cfe985e9476571d7a2873 (diff)
downloademacs-b3fc7a3e763fb260cd932dc6aedbe7b4c810a73c.tar.gz
emacs-b3fc7a3e763fb260cd932dc6aedbe7b4c810a73c.zip
Merge from origin/emacs-25
9ffe7dd * lisp/isearch.el (isearch-define-mode-toggle): Improve logic 16140f7 * lisp/menu-bar.el (menu-bar-options-menu): New search submenu 3db6adb * lisp/isearch.el (search-default-mode) 4ea1ea7 * lisp/isearch.el: Rename search-default-regexp-mode to search-default-mode c77ffc8 Use monitor's resolution for positioning tooltips 49e5749 Fix file-notify-test on MS-Windows be1d874 Fix issues found by auditing w32notify code 87ae218 Extend etags Ruby support for accessors aa35257 Update publicsuffix.txt. 6816bff Ensure that Gnus dribble handling allows removing entries 691feae Be consistent when using encoded strings in nnimap data 3ed423b Display the decoded Gnus group name 5428b5b Use completion-ignore-case instead of defining command
Diffstat (limited to 'lisp')
-rw-r--r--lisp/erc/erc.el10
-rw-r--r--lisp/gnus/gnus-start.el4
-rw-r--r--lisp/gnus/gnus-sum.el3
-rw-r--r--lisp/gnus/nnimap.el26
-rw-r--r--lisp/isearch.el36
-rw-r--r--lisp/menu-bar.el57
6 files changed, 92 insertions, 44 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index d52a83b1029..68460d15c4e 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1141,7 +1141,7 @@ which the local user typed."
1141 (define-key map "\C-c\C-u" 'erc-kill-input) 1141 (define-key map "\C-c\C-u" 'erc-kill-input)
1142 (define-key map "\C-c\C-x" 'erc-quit-server) 1142 (define-key map "\C-c\C-x" 'erc-quit-server)
1143 (define-key map "\M-\t" 'ispell-complete-word) 1143 (define-key map "\M-\t" 'ispell-complete-word)
1144 (define-key map "\t" 'erc-completion-at-point) 1144 (define-key map "\t" 'completion-at-point)
1145 1145
1146 ;; Suppress `font-lock-fontify-block' key binding since it 1146 ;; Suppress `font-lock-fontify-block' key binding since it
1147 ;; destroys face properties. 1147 ;; destroys face properties.
@@ -1463,6 +1463,7 @@ Defaults to the server buffer."
1463 (concat "\C-l\\|\\(^" (regexp-quote (erc-prompt)) "\\)")) 1463 (concat "\C-l\\|\\(^" (regexp-quote (erc-prompt)) "\\)"))
1464 (set (make-local-variable 'paragraph-start) 1464 (set (make-local-variable 'paragraph-start)
1465 (concat "\\(" (regexp-quote (erc-prompt)) "\\)")) 1465 (concat "\\(" (regexp-quote (erc-prompt)) "\\)"))
1466 (setq-local completion-ignore-case t)
1466 (add-hook 'completion-at-point-functions 'erc-complete-word-at-point nil t)) 1467 (add-hook 'completion-at-point-functions 'erc-complete-word-at-point nil t))
1467 1468
1468;; activation 1469;; activation
@@ -3996,13 +3997,6 @@ Prompt for one if called interactively."
3996 (format "MODE %s +k %s" tgt key) 3997 (format "MODE %s +k %s" tgt key)
3997 (format "MODE %s -k" tgt))))) 3998 (format "MODE %s -k" tgt)))))
3998 3999
3999(defun erc-completion-at-point ()
4000 "Perform completion on the text around point case-insensitively.
4001See `completion-at-point'."
4002 (interactive)
4003 (let ((completion-ignore-case t))
4004 (completion-at-point)))
4005
4006(defun erc-quit-server (reason) 4000(defun erc-quit-server (reason)
4007 "Disconnect from current server after prompting for REASON. 4001 "Disconnect from current server after prompting for REASON.
4008`erc-quit-reason' works with this just like with `erc-cmd-QUIT'." 4002`erc-quit-reason' works with this just like with `erc-cmd-QUIT'."
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index f2e69781fc1..692c8346130 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -862,7 +862,9 @@ If REGEXP is given, lines that match it will be deleted."
862 (goto-char (match-beginning 0)) 862 (goto-char (match-beginning 0))
863 (delete-region (point-at-bol) end)))) 863 (delete-region (point-at-bol) end))))
864 (goto-char (point-max)) 864 (goto-char (point-max))
865 (insert string "\n") 865 ;; Make sure that each dribble entry is a single line, so that
866 ;; the "remove" code above works.
867 (insert (replace-regexp-in-string "\n" "\\\\n" string) "\n")
866 ;; This has been commented by Josh Huber <huber@alum.wpi.edu> 868 ;; This has been commented by Josh Huber <huber@alum.wpi.edu>
867 ;; It causes problems with both XEmacs and Emacs 21, and doesn't 869 ;; It causes problems with both XEmacs and Emacs 21, and doesn't
868 ;; seem to be of much value. (FIXME: remove this after we make sure 870 ;; seem to be of much value. (FIXME: remove this after we make sure
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index bc31ce91346..c8f0fa31300 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -4011,7 +4011,8 @@ If SELECT-ARTICLES, only select those articles from GROUP."
4011 (gnus-group-next-unread-group 1)) 4011 (gnus-group-next-unread-group 1))
4012 (gnus-handle-ephemeral-exit quit-config))) 4012 (gnus-handle-ephemeral-exit quit-config)))
4013 (if (null (gnus-list-of-unread-articles group)) 4013 (if (null (gnus-list-of-unread-articles group))
4014 (gnus-message 3 "Group %s contains no messages" group) 4014 (gnus-message 3 "Group %s contains no messages"
4015 (gnus-group-decoded-name group))
4015 (gnus-message 3 "Can't select group")) 4016 (gnus-message 3 "Can't select group"))
4016 nil) 4017 nil)
4017 ;; The user did a `C-g' while prompting for number of articles, 4018 ;; The user did a `C-g' while prompting for number of articles,
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 05251ed464a..c285befc760 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -113,6 +113,12 @@ some servers.")
113 113
114(defvoo nnimap-current-infos nil) 114(defvoo nnimap-current-infos nil)
115 115
116(defun nnimap-decode-gnus-group (group)
117 (decode-coding-string group 'utf-8))
118
119(defun nnimap-encode-gnus-group (group)
120 (encode-coding-string group 'utf-8))
121
116(defvoo nnimap-fetch-partial-articles nil 122(defvoo nnimap-fetch-partial-articles nil
117 "If non-nil, Gnus will fetch partial articles. 123 "If non-nil, Gnus will fetch partial articles.
118If t, Gnus will fetch only the first part. If a string, it 124If t, Gnus will fetch only the first part. If a string, it
@@ -794,9 +800,6 @@ textual parts.")
794 (incf num))) 800 (incf num)))
795 (nreverse parts))) 801 (nreverse parts)))
796 802
797(defun nnimap-decode-gnus-group (group)
798 (decode-coding-string group 'utf-8))
799
800(deffoo nnimap-request-group (group &optional server dont-check info) 803(deffoo nnimap-request-group (group &optional server dont-check info)
801 (setq group (nnimap-decode-gnus-group group)) 804 (setq group (nnimap-decode-gnus-group group))
802 (let ((result (nnimap-change-group 805 (let ((result (nnimap-change-group
@@ -825,7 +828,7 @@ textual parts.")
825 (- (cdr active) (car active)) 828 (- (cdr active) (car active))
826 (car active) 829 (car active)
827 (cdr active) 830 (cdr active)
828 group)) 831 (nnimap-encode-gnus-group group)))
829 t)))) 832 t))))
830 833
831(deffoo nnimap-request-group-scan (group &optional server info) 834(deffoo nnimap-request-group-scan (group &optional server info)
@@ -860,7 +863,8 @@ textual parts.")
860 (erase-buffer) 863 (erase-buffer)
861 (insert 864 (insert
862 (format 865 (format
863 "211 %d %d %d %S\n" (1+ (- high low)) low high group)) 866 "211 %d %d %d %S\n" (1+ (- high low)) low high
867 (nnimap-encode-gnus-group group)))
864 t)))) 868 t))))
865 869
866(deffoo nnimap-request-create-group (group &optional server _args) 870(deffoo nnimap-request-create-group (group &optional server _args)
@@ -1323,7 +1327,7 @@ If LIMIT, first try to limit the search to the N last articles."
1323 (let* ((sequence (car response)) 1327 (let* ((sequence (car response))
1324 (response (cadr response)) 1328 (response (cadr response))
1325 (group (cadr (assoc sequence sequences))) 1329 (group (cadr (assoc sequence sequences)))
1326 (egroup (encode-coding-string group 'utf-8))) 1330 (egroup (nnimap-encode-gnus-group group)))
1327 (when (and group 1331 (when (and group
1328 (equal (caar response) "OK")) 1332 (equal (caar response) "OK"))
1329 (let ((uidnext (nnimap-find-parameter "UIDNEXT" response)) 1333 (let ((uidnext (nnimap-find-parameter "UIDNEXT" response))
@@ -1354,7 +1358,7 @@ If LIMIT, first try to limit the search to the N last articles."
1354 (nnimap-get-groups))) 1358 (nnimap-get-groups)))
1355 (unless (assoc group nnimap-current-infos) 1359 (unless (assoc group nnimap-current-infos)
1356 ;; Insert dummy numbers here -- they don't matter. 1360 ;; Insert dummy numbers here -- they don't matter.
1357 (insert (format "%S 0 1 y\n" (encode-coding-string group 'utf-8))))) 1361 (insert (format "%S 0 1 y\n" (nnimap-encode-gnus-group group)))))
1358 t))) 1362 t)))
1359 1363
1360(deffoo nnimap-retrieve-group-data-early (server infos) 1364(deffoo nnimap-retrieve-group-data-early (server infos)
@@ -1453,8 +1457,9 @@ If LIMIT, first try to limit the search to the N last articles."
1453 (active (gnus-active group))) 1457 (active (gnus-active group)))
1454 (when active 1458 (when active
1455 (insert (format "%S %d %d y\n" 1459 (insert (format "%S %d %d y\n"
1456 (decode-coding-string 1460 (nnimap-encode-gnus-group
1457 (gnus-group-real-name group) 'utf-8) 1461 (nnimap-decode-gnus-group
1462 (gnus-group-real-name group)))
1458 (cdr active) 1463 (cdr active)
1459 (car active)))))))))))) 1464 (car active))))))))))))
1460 1465
@@ -1672,7 +1677,8 @@ If LIMIT, first try to limit the search to the N last articles."
1672 (nreverse result)))) 1677 (nreverse result))))
1673 1678
1674(defun nnimap-store-info (info active) 1679(defun nnimap-store-info (info active)
1675 (let* ((group (gnus-group-real-name (gnus-info-group info))) 1680 (let* ((group (nnimap-decode-gnus-group
1681 (gnus-group-real-name (gnus-info-group info))))
1676 (entry (assoc group nnimap-current-infos))) 1682 (entry (assoc group nnimap-current-infos)))
1677 (if entry 1683 (if entry
1678 (setcdr entry (list info active)) 1684 (setcdr entry (list info active))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index c36f4631549..2efa4c7e8ef 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -224,7 +224,7 @@ Default value, nil, means edit the string instead."
224 224
225(autoload 'character-fold-to-regexp "character-fold") 225(autoload 'character-fold-to-regexp "character-fold")
226 226
227(defcustom search-default-regexp-mode #'character-fold-to-regexp 227(defcustom search-default-mode #'character-fold-to-regexp
228 "Default mode to use when starting isearch. 228 "Default mode to use when starting isearch.
229Value is nil, t, or a function. 229Value is nil, t, or a function.
230 230
@@ -234,9 +234,9 @@ If t, default to regexp searches (as if typing `\\[isearch-toggle-regexp]' durin
234isearch). 234isearch).
235 235
236If a function, use that function as an `isearch-regexp-function'. 236If a function, use that function as an `isearch-regexp-function'.
237Example functions are `word-search-regexp' \(`\\[isearch-toggle-word]'), 237Example functions (and the keys to toggle them during isearch)
238`isearch-symbol-regexp' \(`\\[isearch-toggle-symbol]'), and 238are `word-search-regexp' \(`\\[isearch-toggle-word]'), `isearch-symbol-regexp'
239`character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')." 239\(`\\[isearch-toggle-symbol]'), and `character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')."
240 ;; :type is set below by `isearch-define-mode-toggle'. 240 ;; :type is set below by `isearch-define-mode-toggle'.
241 :type '(choice (const :tag "Literal search" nil) 241 :type '(choice (const :tag "Literal search" nil)
242 (const :tag "Regexp search" t) 242 (const :tag "Regexp search" t)
@@ -558,7 +558,11 @@ If the value is a function (e.g. `isearch-symbol-regexp'), it is
558called to convert a plain search string to a regexp used by 558called to convert a plain search string to a regexp used by
559regexp search functions. 559regexp search functions.
560The symbol property `isearch-message-prefix' put on this function 560The symbol property `isearch-message-prefix' put on this function
561specifies the prefix string displayed in the search message.") 561specifies the prefix string displayed in the search message.
562
563This variable is set and changed during isearch. To change the
564default behaviour used for searches, see `search-default-mode'
565instead.")
562;; We still support setting this to t for backwards compatibility. 566;; We still support setting this to t for backwards compatibility.
563(define-obsolete-variable-alias 'isearch-word 567(define-obsolete-variable-alias 'isearch-word
564 'isearch-regexp-function "25.1") 568 'isearch-regexp-function "25.1")
@@ -868,11 +872,11 @@ used to set the value of `isearch-regexp-function'."
868 (setq isearch-forward forward 872 (setq isearch-forward forward
869 isearch-regexp (or regexp 873 isearch-regexp (or regexp
870 (and (not regexp-function) 874 (and (not regexp-function)
871 (eq search-default-regexp-mode t))) 875 (eq search-default-mode t)))
872 isearch-regexp-function (or regexp-function 876 isearch-regexp-function (or regexp-function
873 (and (functionp search-default-regexp-mode) 877 (and (functionp search-default-mode)
874 (not regexp) 878 (not regexp)
875 search-default-regexp-mode)) 879 search-default-mode))
876 isearch-op-fun op-fun 880 isearch-op-fun op-fun
877 isearch-last-case-fold-search isearch-case-fold-search 881 isearch-last-case-fold-search isearch-case-fold-search
878 isearch-case-fold-search case-fold-search 882 isearch-case-fold-search case-fold-search
@@ -1506,7 +1510,7 @@ Use `isearch-exit' to quit without signaling."
1506 (isearch-repeat 'backward)) 1510 (isearch-repeat 'backward))
1507 1511
1508 1512
1509;;; Toggles for `isearch-regexp-function' and `search-default-regexp-mode'. 1513;;; Toggles for `isearch-regexp-function' and `search-default-mode'.
1510(defmacro isearch-define-mode-toggle (mode key function &optional docstring &rest body) 1514(defmacro isearch-define-mode-toggle (mode key function &optional docstring &rest body)
1511 "Define a command called `isearch-toggle-MODE' and bind it to `M-s KEY'. 1515 "Define a command called `isearch-toggle-MODE' and bind it to `M-s KEY'.
1512The first line of the command's docstring is auto-generated, the 1516The first line of the command's docstring is auto-generated, the
@@ -1524,21 +1528,19 @@ The command then executes BODY and updates the isearch prompt."
1524 (if docstring (concat "\n" docstring) "")) 1528 (if docstring (concat "\n" docstring) ""))
1525 (interactive) 1529 (interactive)
1526 ,@(when function 1530 ,@(when function
1527 `((setq isearch-regexp-function 1531 `((setq isearch-regexp-function #',function)
1528 (unless (eq isearch-regexp-function #',function) 1532 (setq isearch-regexp nil)))
1529 #',function))
1530 (when isearch-regexp-function (setq isearch-regexp nil))))
1531 ,@body 1533 ,@body
1532 (setq isearch-success t isearch-adjusted t) 1534 (setq isearch-success t isearch-adjusted t)
1533 (isearch-update)) 1535 (isearch-update))
1534 (define-key isearch-mode-map ,key #',command-name) 1536 (define-key isearch-mode-map ,key #',command-name)
1535 ,@(when (symbolp function) 1537 ,@(when (and function (symbolp function))
1536 `((put ',function 'isearch-message-prefix ,(format "%s " mode)) 1538 `((put ',function 'isearch-message-prefix ,(format "%s " mode))
1537 (put ',function :advertised-binding ,key) 1539 (put ',function :advertised-binding ,key)
1538 (cl-callf (lambda (types) (cons 'choice 1540 (cl-callf (lambda (types) (cons 'choice
1539 (cons '(const :tag ,(capitalize (format "%s search" mode)) ,function) 1541 (cons '(const :tag ,(capitalize (format "%s search" mode)) ,function)
1540 (cdr types)))) 1542 (cdr types))))
1541 (get 'search-default-regexp-mode 'custom-type))))))) 1543 (get 'search-default-mode 'custom-type)))))))
1542 1544
1543(isearch-define-mode-toggle word "w" word-search-regexp "\ 1545(isearch-define-mode-toggle word "w" word-search-regexp "\
1544Turning on word search turns off regexp mode.") 1546Turning on word search turns off regexp mode.")
@@ -2571,7 +2573,7 @@ the word mode."
2571 (setq regexp-function #'word-search-regexp)) 2573 (setq regexp-function #'word-search-regexp))
2572 (let ((description 2574 (let ((description
2573 ;; Don't use a description on the default search mode. 2575 ;; Don't use a description on the default search mode.
2574 (cond ((equal regexp-function search-default-regexp-mode) "") 2576 (cond ((equal regexp-function search-default-mode) "")
2575 (regexp-function 2577 (regexp-function
2576 (and (symbolp regexp-function) 2578 (and (symbolp regexp-function)
2577 (or (get regexp-function 'isearch-message-prefix) 2579 (or (get regexp-function 'isearch-message-prefix)
@@ -2579,7 +2581,7 @@ the word mode."
2579 (isearch-regexp "regexp ") 2581 (isearch-regexp "regexp ")
2580 ;; We're in literal mode. If the default mode is not 2582 ;; We're in literal mode. If the default mode is not
2581 ;; literal, then describe it. 2583 ;; literal, then describe it.
2582 ((functionp search-default-regexp-mode) "literal ")))) 2584 ((functionp search-default-mode) "literal "))))
2583 (if space-before 2585 (if space-before
2584 ;; Move space from the end to the beginning. 2586 ;; Move space from the end to the beginning.
2585 (replace-regexp-in-string "\\(.*\\) \\'" " \\1" description) 2587 (replace-regexp-in-string "\\(.*\\) \\'" " \\1" description)
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 512d65fa580..cc7233e193f 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -244,7 +244,7 @@
244 (setq menu-bar-last-search-type 'string) 244 (setq menu-bar-last-search-type 'string)
245 ;; Ideally, this whole command would be equivalent to `C-s RET'. 245 ;; Ideally, this whole command would be equivalent to `C-s RET'.
246 (let ((isearch-forward (not backward)) 246 (let ((isearch-forward (not backward))
247 (isearch-regexp-function search-default-regexp-mode) 247 (isearch-regexp-function search-default-mode)
248 (isearch-regexp nil)) 248 (isearch-regexp nil))
249 (if (or (equal string "") (not string)) 249 (if (or (equal string "") (not string))
250 (funcall (isearch-search-fun-default) (car search-ring)) 250 (funcall (isearch-search-fun-default) (car search-ring))
@@ -1256,6 +1256,52 @@ mail status in mode line"))
1256 :enable (not (truncated-partial-width-window-p)))) 1256 :enable (not (truncated-partial-width-window-p))))
1257 menu)) 1257 menu))
1258 1258
1259(defvar menu-bar-search-options-menu
1260 (let ((menu (make-sparse-keymap "Search Options")))
1261
1262 (dolist (x '((character-fold-to-regexp "Fold Characters" "Character folding")
1263 (isearch-symbol-regexp "Whole Symbols" "Whole symbol")
1264 (word-search-regexp "Whole Words" "Whole word")))
1265 (bindings--define-key menu (vector (nth 0 x))
1266 `(menu-item ,(nth 1 x)
1267 (lambda ()
1268 (interactive)
1269 (setq search-default-mode #',(nth 0 x))
1270 (message ,(format "%s search enabled" (nth 2 x))))
1271 :help ,(format "Enable %s search" (downcase (nth 2 x)))
1272 :button (:radio . (eq search-default-mode #',(nth 0 x))))))
1273
1274 (bindings--define-key menu [regexp-search]
1275 '(menu-item "Regular Expression"
1276 (lambda ()
1277 (interactive)
1278 (setq search-default-mode t)
1279 (message "Regular-expression search enabled"))
1280 :help "Enable regular-expression search"
1281 :button (:radio . (eq search-default-mode t))))
1282
1283 (bindings--define-key menu [regular-search]
1284 '(menu-item "Literal Search"
1285 (lambda ()
1286 (interactive)
1287 (when search-default-mode
1288 (setq search-default-mode nil)
1289 (when (symbolp search-default-mode)
1290 (message "Literal search enabled"))))
1291 :help "Disable special search modes"
1292 :button (:radio . (not search-default-mode))))
1293
1294 (bindings--define-key menu [custom-separator]
1295 menu-bar-separator)
1296 (bindings--define-key menu [case-fold-search]
1297 (menu-bar-make-toggle
1298 toggle-case-fold-search case-fold-search
1299 "Ignore Case"
1300 "Case-Insensitive Search %s"
1301 "Ignore letter-case in search commands"))
1302
1303 menu))
1304
1259(defvar menu-bar-options-menu 1305(defvar menu-bar-options-menu
1260 (let ((menu (make-sparse-keymap "Options"))) 1306 (let ((menu (make-sparse-keymap "Options")))
1261 (bindings--define-key menu [customize] 1307 (bindings--define-key menu [customize]
@@ -1367,12 +1413,9 @@ mail status in mode line"))
1367 (:visible (and (boundp 'cua-enable-cua-keys) 1413 (:visible (and (boundp 'cua-enable-cua-keys)
1368 (not cua-enable-cua-keys))))) 1414 (not cua-enable-cua-keys)))))
1369 1415
1370 (bindings--define-key menu [case-fold-search] 1416 (bindings--define-key menu [search-options]
1371 (menu-bar-make-toggle 1417 `(menu-item "Default Search Options"
1372 toggle-case-fold-search case-fold-search 1418 ,menu-bar-search-options-menu))
1373 "Ignore Case for Search"
1374 "Case-Insensitive Search %s"
1375 "Ignore letter-case in search commands"))
1376 1419
1377 (bindings--define-key menu [line-wrapping] 1420 (bindings--define-key menu [line-wrapping]
1378 `(menu-item "Line Wrapping in This Buffer" 1421 `(menu-item "Line Wrapping in This Buffer"