summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-02-09 14:23:10 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2016-02-09 14:23:10 -0800
commitb3fc7a3e763fb260cd932dc6aedbe7b4c810a73c (patch)
tree72495a45c9e58f16f6b09448f6956507da6ccf89 /lisp
parentc71e7cc113ed0d5f01aaa2e441a3e3c9fbeb9fa5 (diff)
parent9ffe7ddd5e1ba93f327cfe985e9476571d7a2873 (diff)
downloademacs-b3fc7a3e763fb260cd932dc6aedbe7b4c810a73c.tar.gz
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."
(define-key map "\C-c\C-u" 'erc-kill-input)
(define-key map "\C-c\C-x" 'erc-quit-server)
(define-key map "\M-\t" 'ispell-complete-word)
- (define-key map "\t" 'erc-completion-at-point)
+ (define-key map "\t" 'completion-at-point)
;; Suppress `font-lock-fontify-block' key binding since it
;; destroys face properties.
@@ -1463,6 +1463,7 @@ Defaults to the server buffer."
(concat "\C-l\\|\\(^" (regexp-quote (erc-prompt)) "\\)"))
(set (make-local-variable 'paragraph-start)
(concat "\\(" (regexp-quote (erc-prompt)) "\\)"))
+ (setq-local completion-ignore-case t)
(add-hook 'completion-at-point-functions 'erc-complete-word-at-point nil t))
;; activation
@@ -3996,13 +3997,6 @@ Prompt for one if called interactively."
(format "MODE %s +k %s" tgt key)
(format "MODE %s -k" tgt)))))
-(defun erc-completion-at-point ()
- "Perform completion on the text around point case-insensitively.
-See `completion-at-point'."
- (interactive)
- (let ((completion-ignore-case t))
- (completion-at-point)))
-
(defun erc-quit-server (reason)
"Disconnect from current server after prompting for REASON.
`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."
(goto-char (match-beginning 0))
(delete-region (point-at-bol) end))))
(goto-char (point-max))
- (insert string "\n")
+ ;; Make sure that each dribble entry is a single line, so that
+ ;; the "remove" code above works.
+ (insert (replace-regexp-in-string "\n" "\\\\n" string) "\n")
;; This has been commented by Josh Huber <huber@alum.wpi.edu>
;; It causes problems with both XEmacs and Emacs 21, and doesn't
;; 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."
(gnus-group-next-unread-group 1))
(gnus-handle-ephemeral-exit quit-config)))
(if (null (gnus-list-of-unread-articles group))
- (gnus-message 3 "Group %s contains no messages" group)
+ (gnus-message 3 "Group %s contains no messages"
+ (gnus-group-decoded-name group))
(gnus-message 3 "Can't select group"))
nil)
;; 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.")
(defvoo nnimap-current-infos nil)
+(defun nnimap-decode-gnus-group (group)
+ (decode-coding-string group 'utf-8))
+
+(defun nnimap-encode-gnus-group (group)
+ (encode-coding-string group 'utf-8))
+
(defvoo nnimap-fetch-partial-articles nil
"If non-nil, Gnus will fetch partial articles.
If t, Gnus will fetch only the first part. If a string, it
@@ -794,9 +800,6 @@ textual parts.")
(incf num)))
(nreverse parts)))
-(defun nnimap-decode-gnus-group (group)
- (decode-coding-string group 'utf-8))
-
(deffoo nnimap-request-group (group &optional server dont-check info)
(setq group (nnimap-decode-gnus-group group))
(let ((result (nnimap-change-group
@@ -825,7 +828,7 @@ textual parts.")
(- (cdr active) (car active))
(car active)
(cdr active)
- group))
+ (nnimap-encode-gnus-group group)))
t))))
(deffoo nnimap-request-group-scan (group &optional server info)
@@ -860,7 +863,8 @@ textual parts.")
(erase-buffer)
(insert
(format
- "211 %d %d %d %S\n" (1+ (- high low)) low high group))
+ "211 %d %d %d %S\n" (1+ (- high low)) low high
+ (nnimap-encode-gnus-group group)))
t))))
(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."
(let* ((sequence (car response))
(response (cadr response))
(group (cadr (assoc sequence sequences)))
- (egroup (encode-coding-string group 'utf-8)))
+ (egroup (nnimap-encode-gnus-group group)))
(when (and group
(equal (caar response) "OK"))
(let ((uidnext (nnimap-find-parameter "UIDNEXT" response))
@@ -1354,7 +1358,7 @@ If LIMIT, first try to limit the search to the N last articles."
(nnimap-get-groups)))
(unless (assoc group nnimap-current-infos)
;; Insert dummy numbers here -- they don't matter.
- (insert (format "%S 0 1 y\n" (encode-coding-string group 'utf-8)))))
+ (insert (format "%S 0 1 y\n" (nnimap-encode-gnus-group group)))))
t)))
(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."
(active (gnus-active group)))
(when active
(insert (format "%S %d %d y\n"
- (decode-coding-string
- (gnus-group-real-name group) 'utf-8)
+ (nnimap-encode-gnus-group
+ (nnimap-decode-gnus-group
+ (gnus-group-real-name group)))
(cdr active)
(car active))))))))))))
@@ -1672,7 +1677,8 @@ If LIMIT, first try to limit the search to the N last articles."
(nreverse result))))
(defun nnimap-store-info (info active)
- (let* ((group (gnus-group-real-name (gnus-info-group info)))
+ (let* ((group (nnimap-decode-gnus-group
+ (gnus-group-real-name (gnus-info-group info))))
(entry (assoc group nnimap-current-infos)))
(if entry
(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."
(autoload 'character-fold-to-regexp "character-fold")
-(defcustom search-default-regexp-mode #'character-fold-to-regexp
+(defcustom search-default-mode #'character-fold-to-regexp
"Default mode to use when starting isearch.
Value is nil, t, or a function.
@@ -234,9 +234,9 @@ If t, default to regexp searches (as if typing `\\[isearch-toggle-regexp]' durin
isearch).
If a function, use that function as an `isearch-regexp-function'.
-Example functions are `word-search-regexp' \(`\\[isearch-toggle-word]'),
-`isearch-symbol-regexp' \(`\\[isearch-toggle-symbol]'), and
-`character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')."
+Example functions (and the keys to toggle them during isearch)
+are `word-search-regexp' \(`\\[isearch-toggle-word]'), `isearch-symbol-regexp'
+\(`\\[isearch-toggle-symbol]'), and `character-fold-to-regexp' \(`\\[isearch-toggle-character-fold]')."
;; :type is set below by `isearch-define-mode-toggle'.
:type '(choice (const :tag "Literal search" nil)
(const :tag "Regexp search" t)
@@ -558,7 +558,11 @@ If the value is a function (e.g. `isearch-symbol-regexp'), it is
called to convert a plain search string to a regexp used by
regexp search functions.
The symbol property `isearch-message-prefix' put on this function
-specifies the prefix string displayed in the search message.")
+specifies the prefix string displayed in the search message.
+
+This variable is set and changed during isearch. To change the
+default behaviour used for searches, see `search-default-mode'
+instead.")
;; We still support setting this to t for backwards compatibility.
(define-obsolete-variable-alias 'isearch-word
'isearch-regexp-function "25.1")
@@ -868,11 +872,11 @@ used to set the value of `isearch-regexp-function'."
(setq isearch-forward forward
isearch-regexp (or regexp
(and (not regexp-function)
- (eq search-default-regexp-mode t)))
+ (eq search-default-mode t)))
isearch-regexp-function (or regexp-function
- (and (functionp search-default-regexp-mode)
+ (and (functionp search-default-mode)
(not regexp)
- search-default-regexp-mode))
+ search-default-mode))
isearch-op-fun op-fun
isearch-last-case-fold-search isearch-case-fold-search
isearch-case-fold-search case-fold-search
@@ -1506,7 +1510,7 @@ Use `isearch-exit' to quit without signaling."
(isearch-repeat 'backward))
-;;; Toggles for `isearch-regexp-function' and `search-default-regexp-mode'.
+;;; Toggles for `isearch-regexp-function' and `search-default-mode'.
(defmacro isearch-define-mode-toggle (mode key function &optional docstring &rest body)
"Define a command called `isearch-toggle-MODE' and bind it to `M-s KEY'.
The 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."
(if docstring (concat "\n" docstring) ""))
(interactive)
,@(when function
- `((setq isearch-regexp-function
- (unless (eq isearch-regexp-function #',function)
- #',function))
- (when isearch-regexp-function (setq isearch-regexp nil))))
+ `((setq isearch-regexp-function #',function)
+ (setq isearch-regexp nil)))
,@body
(setq isearch-success t isearch-adjusted t)
(isearch-update))
(define-key isearch-mode-map ,key #',command-name)
- ,@(when (symbolp function)
+ ,@(when (and function (symbolp function))
`((put ',function 'isearch-message-prefix ,(format "%s " mode))
(put ',function :advertised-binding ,key)
(cl-callf (lambda (types) (cons 'choice
(cons '(const :tag ,(capitalize (format "%s search" mode)) ,function)
(cdr types))))
- (get 'search-default-regexp-mode 'custom-type)))))))
+ (get 'search-default-mode 'custom-type)))))))
(isearch-define-mode-toggle word "w" word-search-regexp "\
Turning on word search turns off regexp mode.")
@@ -2571,7 +2573,7 @@ the word mode."
(setq regexp-function #'word-search-regexp))
(let ((description
;; Don't use a description on the default search mode.
- (cond ((equal regexp-function search-default-regexp-mode) "")
+ (cond ((equal regexp-function search-default-mode) "")
(regexp-function
(and (symbolp regexp-function)
(or (get regexp-function 'isearch-message-prefix)
@@ -2579,7 +2581,7 @@ the word mode."
(isearch-regexp "regexp ")
;; We're in literal mode. If the default mode is not
;; literal, then describe it.
- ((functionp search-default-regexp-mode) "literal "))))
+ ((functionp search-default-mode) "literal "))))
(if space-before
;; Move space from the end to the beginning.
(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 @@
(setq menu-bar-last-search-type 'string)
;; Ideally, this whole command would be equivalent to `C-s RET'.
(let ((isearch-forward (not backward))
- (isearch-regexp-function search-default-regexp-mode)
+ (isearch-regexp-function search-default-mode)
(isearch-regexp nil))
(if (or (equal string "") (not string))
(funcall (isearch-search-fun-default) (car search-ring))
@@ -1256,6 +1256,52 @@ mail status in mode line"))
:enable (not (truncated-partial-width-window-p))))
menu))
+(defvar menu-bar-search-options-menu
+ (let ((menu (make-sparse-keymap "Search Options")))
+
+ (dolist (x '((character-fold-to-regexp "Fold Characters" "Character folding")
+ (isearch-symbol-regexp "Whole Symbols" "Whole symbol")
+ (word-search-regexp "Whole Words" "Whole word")))
+ (bindings--define-key menu (vector (nth 0 x))
+ `(menu-item ,(nth 1 x)
+ (lambda ()
+ (interactive)
+ (setq search-default-mode #',(nth 0 x))
+ (message ,(format "%s search enabled" (nth 2 x))))
+ :help ,(format "Enable %s search" (downcase (nth 2 x)))
+ :button (:radio . (eq search-default-mode #',(nth 0 x))))))
+
+ (bindings--define-key menu [regexp-search]
+ '(menu-item "Regular Expression"
+ (lambda ()
+ (interactive)
+ (setq search-default-mode t)
+ (message "Regular-expression search enabled"))
+ :help "Enable regular-expression search"
+ :button (:radio . (eq search-default-mode t))))
+
+ (bindings--define-key menu [regular-search]
+ '(menu-item "Literal Search"
+ (lambda ()
+ (interactive)
+ (when search-default-mode
+ (setq search-default-mode nil)
+ (when (symbolp search-default-mode)
+ (message "Literal search enabled"))))
+ :help "Disable special search modes"
+ :button (:radio . (not search-default-mode))))
+
+ (bindings--define-key menu [custom-separator]
+ menu-bar-separator)
+ (bindings--define-key menu [case-fold-search]
+ (menu-bar-make-toggle
+ toggle-case-fold-search case-fold-search
+ "Ignore Case"
+ "Case-Insensitive Search %s"
+ "Ignore letter-case in search commands"))
+
+ menu))
+
(defvar menu-bar-options-menu
(let ((menu (make-sparse-keymap "Options")))
(bindings--define-key menu [customize]
@@ -1367,12 +1413,9 @@ mail status in mode line"))
(:visible (and (boundp 'cua-enable-cua-keys)
(not cua-enable-cua-keys)))))
- (bindings--define-key menu [case-fold-search]
- (menu-bar-make-toggle
- toggle-case-fold-search case-fold-search
- "Ignore Case for Search"
- "Case-Insensitive Search %s"
- "Ignore letter-case in search commands"))
+ (bindings--define-key menu [search-options]
+ `(menu-item "Default Search Options"
+ ,menu-bar-search-options-menu))
(bindings--define-key menu [line-wrapping]
`(menu-item "Line Wrapping in This Buffer"