diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/calendar/todo-mode.el | 30 | ||||
-rw-r--r-- | lisp/char-fold.el | 2 | ||||
-rw-r--r-- | lisp/cus-start.el | 1 | ||||
-rw-r--r-- | lisp/files.el | 21 | ||||
-rw-r--r-- | lisp/gnus/nnimap.el | 93 | ||||
-rw-r--r-- | lisp/international/fontset.el | 4 | ||||
-rw-r--r-- | lisp/international/iso-transl.el | 24 | ||||
-rw-r--r-- | lisp/international/mule-conf.el | 10 | ||||
-rw-r--r-- | lisp/jsonrpc.el | 113 | ||||
-rw-r--r-- | lisp/language/thai.el | 4 | ||||
-rw-r--r-- | lisp/progmodes/xref.el | 6 | ||||
-rw-r--r-- | lisp/startup.el | 4 | ||||
-rw-r--r-- | lisp/textmodes/flyspell.el | 37 | ||||
-rw-r--r-- | lisp/textmodes/ispell.el | 6 | ||||
-rw-r--r-- | lisp/vc/vc-hooks.el | 30 | ||||
-rw-r--r-- | lisp/w32-fns.el | 2 |
16 files changed, 268 insertions, 119 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 6ff4d2a0a52..c1c292129e2 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -863,6 +863,7 @@ category is the first)." (not (zerop (todo-get-count 'archived)))) (setq todo-category-number (funcall setcatnum)))) (todo-category-select) + (if transient-mark-mode (deactivate-mark)) (goto-char (point-min)))) (defun todo-backward-category () @@ -928,12 +929,13 @@ Categories mode." (when goto-archive (todo-archive-mode)) (set-window-buffer (selected-window) (set-buffer (find-buffer-visiting file0))) + (if transient-mark-mode (deactivate-mark)) (unless todo-global-current-todo-file (setq todo-global-current-todo-file todo-current-todo-file)) (todo-category-number category) (todo-category-select) (goto-char (point-min)) - (if (and (boundp 'hl-line-mode) hl-line-mode) (hl-line-highlight)) + (if (bound-and-true-p hl-line-mode) (hl-line-highlight)) (when add-item (todo-insert-item--basic)))))) (defun todo-next-item (&optional count) @@ -1019,15 +1021,17 @@ empty line above the done items separator." (setq shown (progn (goto-char (point-min)) (re-search-forward todo-done-string-start nil t))) - (if (not (pos-visible-in-window-p shown)) - (recenter) - (goto-char opoint))))))) + (if (pos-visible-in-window-p shown) + (goto-char opoint) + (recenter) + (if transient-mark-mode (deactivate-mark)))))))) (defun todo-toggle-view-done-only () "Switch between displaying only done or only todo items." (interactive) (setq todo-show-done-only (not todo-show-done-only)) - (todo-category-select)) + (todo-category-select) + (if transient-mark-mode (deactivate-mark))) (defun todo-toggle-item-highlighting () "Highlight or unhighlight the todo item the cursor is on." @@ -2230,7 +2234,8 @@ made in the number or names of categories." (insert item)) (kill-buffer) (unless (eq (current-buffer) buf) - (set-window-buffer (selected-window) (set-buffer buf)))) + (set-window-buffer (selected-window) (set-buffer buf))) + (if transient-mark-mode (deactivate-mark))) ;; We got here via `F e'. (when (todo-check-format) ;; FIXME: separate out sexp check? @@ -3839,6 +3844,7 @@ face." (goto-char (point-min)) (while (not (eobp)) (setq match (re-search-forward regex nil t)) + (if (and match transient-mark-mode) (deactivate-mark)) (goto-char (line-beginning-position)) (unless (or (equal (point) 1) (looking-at (concat "^" (regexp-quote todo-category-beg)))) @@ -4037,20 +4043,22 @@ regexp items." (interactive "P") (todo-filter-items 'regexp arg t)) +(defvar todo--fifiles-history nil + "List of short file names used by todo-find-filtered-items-file.") + (defun todo-find-filtered-items-file () "Choose a filtered items file and visit it." (interactive) (let ((files (directory-files todo-directory t "\\.tod[rty]$" t)) - falist sfnlist file) + falist file) (dolist (f files) (let ((sf-name (todo-short-file-name f)) (type (cond ((equal (file-name-extension f) "todr") "regexp") ((equal (file-name-extension f) "todt") "top") ((equal (file-name-extension f) "tody") "diary")))) (push (cons (concat sf-name " (" type ")") f) falist))) - (setq sfnlist (mapcar #'car falist)) - (setq file (completing-read "Choose a filtered items file: " - falist nil t nil 'sfnlist (caar falist))) + (setq file (completing-read "Choose a filtered items file: " falist nil t nil + 'todo--fifiles-history (caar falist))) (setq file (cdr (assoc-string file falist))) (find-file file) (unless (derived-mode-p 'todo-filtered-items-mode) @@ -4079,6 +4087,7 @@ regexp items." t todo-show-with-done))) (todo-category-select)) + (if transient-mark-mode (deactivate-mark)) (goto-char (car found)))))) (defvar todo-multiple-filter-files nil @@ -5312,6 +5321,7 @@ Overrides `diary-goto-entry'." nil t) (todo-category-number (match-string 1)) (todo-category-select) + (if transient-mark-mode (deactivate-mark)) (goto-char opoint)))))) (add-function :override diary-goto-entry-function #'todo-diary-goto-entry) diff --git a/lisp/char-fold.el b/lisp/char-fold.el index 9c05e364dfd..86bd6038e36 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -214,7 +214,7 @@ from which to start." (when (> spaces 0) (push (char-fold--make-space-string spaces) out)) (let ((regexp (apply #'concat (nreverse out)))) - ;; Limited by `MAX_BUF_SIZE' in `regex.c'. + ;; Limited by `MAX_BUF_SIZE' in `regex-emacs.c'. (if (> (length regexp) 5000) (regexp-quote string) regexp)))) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index f31d1df3097..1a5b3caea23 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -345,6 +345,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of ;; keyboard.c (meta-prefix-char keyboard character) (auto-save-interval auto-save integer) + (auto-save-no-message auto-save boolean "27.1") (auto-save-timeout auto-save (choice (const :tag "off" nil) (integer :format "%v"))) (echo-keystrokes minibuffer number) diff --git a/lisp/files.el b/lisp/files.el index 8057def5259..ffa926f63e8 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5078,19 +5078,29 @@ Before and after saving the buffer, this function runs (set-visited-file-name filename))) ;; Support VC version backups. (vc-before-save) + ;; We are hunting a nasty error, which happens on hydra. + ;; Adding traces might help. + (if (getenv "BUG_32226") (message "BUG_32226")) (or (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) + (progn + (if (getenv "BUG_32226") + (message "BUG_32226 %s" buffer-file-name)) + nil) ;; If a hook returned t, file is already "written". ;; Otherwise, write it the usual way now. (let ((dir (file-name-directory (expand-file-name buffer-file-name)))) + (if (getenv "BUG_32226") (message "BUG_32226 %s" dir)) (unless (file-exists-p dir) (if (y-or-n-p (format-message "Directory `%s' does not exist; create? " dir)) (make-directory dir t) (error "Canceled"))) + (if (getenv "BUG_32226") (message "BUG_32226 %s" dir)) (setq setmodes (basic-save-buffer-1))))) + (if (getenv "BUG_32226") (message "BUG_32226")) ;; Now we have saved the current buffer. Let's make sure ;; that buffer-file-coding-system is fixed to what ;; actually used for saving by binding it locally. @@ -5137,6 +5147,7 @@ Before and after saving the buffer, this function runs ;; backup-buffer. (defun basic-save-buffer-2 () (let (tempsetmodes setmodes) + (if (getenv "BUG_32226") (message "BUG_32226 %s" 1)) (if (not (file-writable-p buffer-file-name)) (let ((dir (file-name-directory buffer-file-name))) (if (not (file-directory-p dir)) @@ -5152,10 +5163,12 @@ Before and after saving the buffer, this function runs buffer-file-name))) (setq tempsetmodes t) (error "Attempt to save to a file which you aren't allowed to write")))))) + (if (getenv "BUG_32226") (message "BUG_32226 %s" 2)) (or buffer-backed-up (setq setmodes (backup-buffer))) (let* ((dir (file-name-directory buffer-file-name)) (dir-writable (file-writable-p dir))) + (if (getenv "BUG_32226") (message "BUG_32226 %s" 3)) (if (or (and file-precious-flag dir-writable) (and break-hardlink-on-save (file-exists-p buffer-file-name) @@ -5173,6 +5186,7 @@ Before and after saving the buffer, this function runs ;; Create temp files with strict access rights. It's easy to ;; loosen them later, whereas it's impossible to close the ;; time-window of loose permissions otherwise. + (if (getenv "BUG_32226") (message "BUG_32226 %s" 4)) (condition-case err (progn (clear-visited-file-modtime) @@ -5190,6 +5204,7 @@ Before and after saving the buffer, this function runs ;; If we failed, restore the buffer's modtime. (error (set-visited-file-modtime old-modtime) (signal (car err) (cdr err)))) + (if (getenv "BUG_32226") (message "BUG_32226 %s" 5)) ;; Since we have created an entirely new file, ;; make sure it gets the right permission bits set. (setq setmodes (or setmodes @@ -5199,11 +5214,13 @@ Before and after saving the buffer, this function runs buffer-file-name))) ;; We succeeded in writing the temp file, ;; so rename it. + (if (getenv "BUG_32226") (message "BUG_32226 %s" 6)) (rename-file tempname buffer-file-name t)) ;; If file not writable, see if we can make it writable ;; temporarily while we write it. ;; But no need to do so if we have just backed it up ;; (setmodes is set) because that says we're superseding. + (if (getenv "BUG_32226") (message "BUG_32226 %s" 7)) (cond ((and tempsetmodes (not setmodes)) ;; Change the mode back, after writing. (setq setmodes (list (file-modes buffer-file-name) @@ -5217,6 +5234,7 @@ Before and after saving the buffer, this function runs (nth 1 setmodes))) (set-file-modes buffer-file-name (logior (car setmodes) 128)))))) + (if (getenv "BUG_32226") (message "BUG_32226 %s" 8)) (let (success) (unwind-protect (progn @@ -5225,13 +5243,16 @@ Before and after saving the buffer, this function runs ;; write-region-annotate-functions may make use of it. (write-region nil nil buffer-file-name nil t buffer-file-truename) + (if (getenv "BUG_32226") (message "BUG_32226 %s" 9)) (when save-silently (message nil)) (setq success t)) ;; If we get an error writing the new file, and we made ;; the backup by renaming, undo the backing-up. + (if (getenv "BUG_32226") (message "BUG_32226 %s" 10)) (and setmodes (not success) (progn (rename-file (nth 2 setmodes) buffer-file-name t) + (if (getenv "BUG_32226") (message "BUG_32226 %s" 11)) (setq buffer-backed-up nil)))))) setmodes)) diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 3b397319272..12892c516a7 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -55,6 +55,13 @@ If nnimap-stream is `ssl', this will default to `imaps'. If not, it will default to `imap'.") +(defvoo nnimap-use-namespaces nil + "Whether to use IMAP namespaces. +If in Gnus your folder names in all start with (e.g.) `INBOX', +you probably want to set this to t. The effects of this are +purely cosmetic, but changing this variable will affect the +names of your nnimap groups. ") + (defvoo nnimap-stream 'undecided "How nnimap talks to the IMAP server. The value should be either `undecided', `ssl' or `tls', @@ -110,6 +117,8 @@ some servers.") (defvoo nnimap-current-infos nil) +(defvoo nnimap-namespace nil) + (defun nnimap-decode-gnus-group (group) (decode-coding-string group 'utf-8)) @@ -166,6 +175,19 @@ textual parts.") (defvar nnimap-inhibit-logging nil) +(defun nnimap-group-to-imap (group) + "Convert Gnus group name to IMAP mailbox name." + (let* ((inbox (if nnimap-namespace + (substring nnimap-namespace 0 -1) nil))) + (utf7-encode + (cond ((or (not inbox) + (string-equal group inbox)) + group) + ((string-prefix-p "#" group) + (substring group 1)) + (t + (concat nnimap-namespace group))) t))) + (defun nnimap-buffer () (nnimap-find-process-buffer nntp-server-buffer)) @@ -442,7 +464,8 @@ textual parts.") (props (cdr stream-list)) (greeting (plist-get props :greeting)) (capabilities (plist-get props :capabilities)) - (stream-type (plist-get props :type))) + (stream-type (plist-get props :type)) + (server (nnoo-current-server 'nnimap))) (when (and stream (not (memq (process-status stream) '(open run)))) (setq stream nil)) @@ -475,9 +498,7 @@ textual parts.") ;; the virtual server name and the address (nnimap-credentials (gnus-delete-duplicates - (list - (nnoo-current-server 'nnimap) - nnimap-address)) + (list server nnimap-address)) ports nnimap-user)))) (setq nnimap-object nil) @@ -496,8 +517,17 @@ textual parts.") (dolist (response (cddr (nnimap-command "CAPABILITY"))) (when (string= "CAPABILITY" (upcase (car response))) (setf (nnimap-capabilities nnimap-object) - (mapcar #'upcase (cdr response)))))) - ;; If the login failed, then forget the credentials + (mapcar #'upcase (cdr response))))) + (when (and nnimap-use-namespaces + (nnimap-capability "NAMESPACE")) + (erase-buffer) + (nnimap-wait-for-response (nnimap-send-command "NAMESPACE")) + (let ((response (nnimap-last-response-string))) + (when (string-match + "^\\*\\W+NAMESPACE\\W+((\"\\([^\"\n]+\\)\"\\W+\"\\(.\\)\"))\\W+" + response) + (setq nnimap-namespace (match-string 1 response)))))) + ;; If the login failed, then forget the credentials ;; that are now possibly cached. (dolist (host (list (nnoo-current-server 'nnimap) nnimap-address)) @@ -837,7 +867,7 @@ textual parts.") (with-current-buffer (nnimap-buffer) (erase-buffer) (let ((group-sequence - (nnimap-send-command "SELECT %S" (utf7-encode group t))) + (nnimap-send-command "SELECT %S" (nnimap-group-to-imap group))) (flag-sequence (nnimap-send-command "UID FETCH 1:* FLAGS"))) (setf (nnimap-group nnimap-object) group) @@ -870,13 +900,13 @@ textual parts.") (setq group (nnimap-decode-gnus-group group)) (when (nnimap-change-group nil server) (with-current-buffer (nnimap-buffer) - (car (nnimap-command "CREATE %S" (utf7-encode group t)))))) + (car (nnimap-command "CREATE %S" (nnimap-group-to-imap group)))))) (deffoo nnimap-request-delete-group (group &optional _force server) (setq group (nnimap-decode-gnus-group group)) (when (nnimap-change-group nil server) (with-current-buffer (nnimap-buffer) - (car (nnimap-command "DELETE %S" (utf7-encode group t)))))) + (car (nnimap-command "DELETE %S" (nnimap-group-to-imap group)))))) (deffoo nnimap-request-rename-group (group new-name &optional server) (setq group (nnimap-decode-gnus-group group)) @@ -884,7 +914,7 @@ textual parts.") (with-current-buffer (nnimap-buffer) (nnimap-unselect-group) (car (nnimap-command "RENAME %S %S" - (utf7-encode group t) (utf7-encode new-name t)))))) + (nnimap-group-to-imap group) (nnimap-group-to-imap new-name)))))) (defun nnimap-unselect-group () ;; Make sure we don't have this group open read/write by asking @@ -944,7 +974,7 @@ textual parts.") "UID COPY %d %S")) (result (nnimap-command command article - (utf7-encode internal-move-group t)))) + (nnimap-group-to-imap internal-move-group)))) (when (and (car result) (not can-move)) (nnimap-delete-article article)) (cons internal-move-group @@ -1011,7 +1041,7 @@ textual parts.") "UID MOVE %s %S" "UID COPY %s %S") (nnimap-article-ranges (gnus-compress-sequence articles)) - (utf7-encode (gnus-group-real-name nnmail-expiry-target) t)) + (nnimap-group-to-imap (gnus-group-real-name nnmail-expiry-target))) (set (if can-move 'deleted-articles 'articles-to-delete) articles)))) t) (t @@ -1136,7 +1166,7 @@ If LIMIT, first try to limit the search to the N last articles." (unsubscribe "UNSUBSCRIBE"))))) (when command (with-current-buffer (nnimap-buffer) - (nnimap-command "%s %S" (cadr command) (utf7-encode group t))))))) + (nnimap-command "%s %S" (cadr command) (nnimap-group-to-imap group))))))) (deffoo nnimap-request-set-mark (group actions &optional server) (setq group (nnimap-decode-gnus-group group)) @@ -1191,7 +1221,7 @@ If LIMIT, first try to limit the search to the N last articles." (nnimap-unselect-group)) (erase-buffer) (setq sequence (nnimap-send-command - "APPEND %S {%d}" (utf7-encode group t) + "APPEND %S {%d}" (nnimap-group-to-imap group) (length message))) (unless nnimap-streaming (nnimap-wait-for-connection "^[+]")) @@ -1271,8 +1301,12 @@ If LIMIT, first try to limit the search to the N last articles." (defun nnimap-get-groups () (erase-buffer) - (let ((sequence (nnimap-send-command "LIST \"\" \"*\"")) - groups) + (let* ((sequence (nnimap-send-command "LIST \"\" \"*\"")) + (prefix nnimap-namespace) + (prefix-len (if prefix (length prefix) nil)) + (inbox (if prefix + (substring prefix 0 -1) nil)) + groups) (nnimap-wait-for-response sequence) (subst-char-in-region (point-min) (point-max) ?\\ ?% t) @@ -1289,11 +1323,16 @@ If LIMIT, first try to limit the search to the N last articles." (skip-chars-backward " \r\"") (point))))) (unless (member '%NoSelect flags) - (push (utf7-decode (if (stringp group) - group - (format "%s" group)) - t) - groups)))) + (let* ((group (utf7-decode (if (stringp group) group + (format "%s" group)) t)) + (group (cond ((or (not prefix) + (equal inbox group)) + group) + ((string-prefix-p prefix group) + (substring group prefix-len)) + (t + (concat "#" group))))) + (push group groups))))) (nreverse groups))) (defun nnimap-get-responses (sequences) @@ -1319,7 +1358,7 @@ If LIMIT, first try to limit the search to the N last articles." (dolist (group groups) (setf (nnimap-examined nnimap-object) group) (push (list (nnimap-send-command "EXAMINE %S" - (utf7-encode group t)) + (nnimap-group-to-imap group)) group) sequences)) (nnimap-wait-for-response (caar sequences)) @@ -1391,7 +1430,7 @@ If LIMIT, first try to limit the search to the N last articles." unexist) (push (list (nnimap-send-command "EXAMINE %S (%s (%s %s))" - (utf7-encode group t) + (nnimap-group-to-imap group) (nnimap-quirk "QRESYNC") uidvalidity modseq) 'qresync @@ -1413,7 +1452,7 @@ If LIMIT, first try to limit the search to the N last articles." (cl-incf (nnimap-initial-resync nnimap-object)) (setq start 1)) (push (list (nnimap-send-command "%s %S" command - (utf7-encode group t)) + (nnimap-group-to-imap group)) (nnimap-send-command "UID FETCH %d:* FLAGS" start) start group command) sequences)))) @@ -1847,7 +1886,7 @@ Return the server's response to the SELECT or EXAMINE command." (if read-only "EXAMINE" "SELECT") - (utf7-encode group t)))) + (nnimap-group-to-imap group)))) (when (car result) (setf (nnimap-group nnimap-object) group (nnimap-select-result nnimap-object) result) @@ -2105,7 +2144,7 @@ Return the server's response to the SELECT or EXAMINE command." (dolist (spec specs) (when (and (not (member (car spec) groups)) (not (eq (car spec) 'junk))) - (nnimap-command "CREATE %S" (utf7-encode (car spec) t)))) + (nnimap-command "CREATE %S" (nnimap-group-to-imap (car spec))))) ;; Then copy over all the messages. (erase-buffer) (dolist (spec specs) @@ -2121,7 +2160,7 @@ Return the server's response to the SELECT or EXAMINE command." "UID MOVE %s %S" "UID COPY %s %S") (nnimap-article-ranges ranges) - (utf7-encode group t)) + (nnimap-group-to-imap group)) ranges) sequences))))) ;; Wait for the last COPY response... diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index d4ade3cc4c0..9bd05ceb4a2 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -79,7 +79,7 @@ ("cns11643.92p7-0" . chinese-cns11643-7) ("big5" . big5) ("viscii" . viscii) - ("tis620" . thai-iso8859-11) + ("tis620" . tis620-2533) ("microsoft-cp1251" . windows-1251) ("koi8-r" . koi8-r) ("jisx0213.2000-1" . japanese-jisx0213-1) @@ -139,7 +139,7 @@ (cyrillic-iso8859-5 . iso-8859-5) (greek-iso8859-7 . iso-8859-7) (arabic-iso8859-6 . iso-8859-6) - (thai-tis620 . thai-iso8859-11) + (thai-tis620 . tis620-2533) (latin-jisx0201 . jisx0201) (katakana-jisx0201 . jisx0201) (chinese-big5-1 . big5) diff --git a/lisp/international/iso-transl.el b/lisp/international/iso-transl.el index 1af5c64a485..0856b4f6fbc 100644 --- a/lisp/international/iso-transl.el +++ b/lisp/international/iso-transl.el @@ -234,18 +234,18 @@ sequence VECTOR. (VECTOR is normally one character long.)") ;; Language-specific translation lists. (defvar iso-transl-language-alist '(("Esperanto" - ("C" . [?Æ]) - ("G" . [?Ø]) - ("H" . [?¦]) - ("J" . [?¬]) - ("S" . [?Þ]) - ("U" . [?Ý]) - ("c" . [?æ]) - ("g" . [?ø]) - ("h" . [?¶]) - ("j" . [?¼]) - ("s" . [?þ]) - ("u" . [?ý])) + ("C" . [?Ĉ]) + ("G" . [?Ĝ]) + ("H" . [?Ĥ]) + ("J" . [?Ĵ]) + ("S" . [?Ŝ]) + ("U" . [?Ŭ]) + ("c" . [?ĉ]) + ("g" . [?ĝ]) + ("h" . [?ĥ]) + ("j" . [?ĵ]) + ("s" . [?ŝ]) + ("u" . [?ŭ])) ("French" ("C" . [?Ç]) ("c" . [?ç])) diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el index a635c677705..3affeec03ea 100644 --- a/lisp/international/mule-conf.el +++ b/lisp/international/mule-conf.el @@ -201,7 +201,6 @@ ;; plus nbsp (define-iso-single-byte-charset 'iso-8859-11 'thai-iso8859-11 "ISO/IEC 8859/11" "Latin/Thai" 166 ?T nil "8859-11") -(define-charset-alias 'tis620-2533 'thai-iso8859-11) ;; 8859-12 doesn't (yet?) exist. @@ -223,13 +222,20 @@ ;; Can this be shared with 8859-11? ;; N.b. not all of these are defined in Unicode. (define-charset 'thai-tis620 - "TIS620.2533" + "MULE charset for TIS620.2533" :short-name "TIS620.2533" :iso-final-char ?T :emacs-mule-id 133 :code-space [32 127] :code-offset #x0E00) +(define-charset 'tis620-2533 + "TIS620.2533, a.k.a. TIS-620. Like `thai-iso8859-11', but without NBSP." + :short-name "TIS620.2533" + :ascii-compatible-p t + :code-space [0 255] + :superset '(ascii (thai-tis620 . 128))) + (define-charset 'jisx0201 "JISX0201" :short-name "JISX0201" diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index b2ccea5c143..f3e0982139c 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@ -6,7 +6,7 @@ ;; Maintainer: João Távora <joaotavora@gmail.com> ;; Keywords: processes, languages, extensions ;; Package-Requires: ((emacs "25.2")) -;; Version: 1.0.0 +;; Version: 1.0.3 ;; This is an Elpa :core package. Don't use functionality that is not ;; compatible with Emacs 25.2. @@ -74,7 +74,11 @@ :documentation "A hash table of request ID to continuation lambdas.") (-events-buffer :accessor jsonrpc--events-buffer - :documentation "A buffer pretty-printing the JSON-RPC RPC events") + :documentation "A buffer pretty-printing the JSONRPC events") + (-events-buffer-scrollback-size + :initarg :events-buffer-scrollback-size + :accessor jsonrpc--events-buffer-scrollback-size + :documentation "Max size of events buffer. 0 disables, nil means infinite.") (-deferred-actions :initform (make-hash-table :test #'equal) :accessor jsonrpc--deferred-actions @@ -193,9 +197,7 @@ dispatcher in CONNECTION." (when timer (cancel-timer timer))) (remhash id (jsonrpc--request-continuations connection)) (if error (funcall (nth 1 continuations) error) - (funcall (nth 0 continuations) result))) - (;; An abnormal situation - id (jsonrpc--warn "No continuation for id %s" id))) + (funcall (nth 0 continuations) result)))) (jsonrpc--call-deferred connection)))) @@ -256,17 +258,30 @@ Returns nil." (apply #'jsonrpc--async-request-1 connection method params args) nil) -(cl-defun jsonrpc-request (connection method params &key deferred timeout) +(cl-defun jsonrpc-request (connection + method params &key + deferred timeout + cancel-on-input + cancel-on-input-retval) "Make a request to CONNECTION, wait for a reply. Like `jsonrpc-async-request' for CONNECTION, METHOD and PARAMS, -but synchronous, i.e. this function doesn't exit until anything -interesting (success, error or timeout) happens. Furthermore, it -only exits locally (returning the JSONRPC result object) if the -request is successful, otherwise exit non-locally with an error -of type `jsonrpc-error'. +but synchronous. -DEFERRED is passed to `jsonrpc-async-request', which see." +Except in the case of a non-nil CANCEL-ON-INPUT (explained +below), this function doesn't exit until anything interesting +happens (success reply, error reply, or timeout). Furthermore, +it only exits locally (returning the JSONRPC result object) if +the request is successful, otherwise it exits non-locally with an +error of type `jsonrpc-error'. + +DEFERRED is passed to `jsonrpc-async-request', which see. + +If CANCEL-ON-INPUT is non-nil and the user inputs something while +the functino is waiting, then it exits immediately, returning +CANCEL-ON-INPUT-RETVAL. Any future replies (normal or error) are +ignored." (let* ((tag (cl-gensym "jsonrpc-request-catch-tag")) id-and-timer + cancelled (retval (unwind-protect ; protect against user-quit, for example (catch tag @@ -274,19 +289,27 @@ DEFERRED is passed to `jsonrpc-async-request', which see." id-and-timer (jsonrpc--async-request-1 connection method params - :success-fn (lambda (result) (throw tag `(done ,result))) + :success-fn (lambda (result) + (unless cancelled + (throw tag `(done ,result)))) :error-fn (jsonrpc-lambda (&key code message data) - (throw tag `(error (jsonrpc-error-code . ,code) - (jsonrpc-error-message . ,message) - (jsonrpc-error-data . ,data)))) + (unless cancelled + (throw tag `(error (jsonrpc-error-code . ,code) + (jsonrpc-error-message . ,message) + (jsonrpc-error-data . ,data))))) :timeout-fn (lambda () - (throw tag '(error (jsonrpc-error-message . "Timed out")))) + (unless cancelled + (throw tag '(error (jsonrpc-error-message . "Timed out"))))) :deferred deferred :timeout timeout)) - (while t (accept-process-output nil 30))) + (cond (cancel-on-input + (while (sit-for 30)) + (setq cancelled t) + `(cancelled ,cancel-on-input-retval)) + (t (while t (accept-process-output nil 30))))) (pcase-let* ((`(,id ,timer) id-and-timer)) (remhash id (jsonrpc--request-continuations connection)) (remhash (list deferred (current-buffer)) @@ -629,27 +652,39 @@ TIMEOUT is nil)." CONNECTION is the current connection. MESSAGE is a JSON-like plist. TYPE is a symbol saying if this is a client or server originated." - (with-current-buffer (jsonrpc-events-buffer connection) - (cl-destructuring-bind (&key method id error &allow-other-keys) message - (let* ((inhibit-read-only t) - (subtype (cond ((and method id) 'request) - (method 'notification) - (id 'reply) - (t 'message))) - (type - (concat (format "%s" (or type 'internal)) - (if type - (format "-%s" subtype))))) - (goto-char (point-max)) - (let ((msg (format "%s%s%s %s:\n%s\n" - type - (if id (format " (id:%s)" id) "") - (if error " ERROR" "") - (current-time-string) - (pp-to-string message)))) - (when error - (setq msg (propertize msg 'face 'error))) - (insert-before-markers msg)))))) + (let ((max (jsonrpc--events-buffer-scrollback-size connection))) + (when (or (null max) (cl-plusp max)) + (with-current-buffer (jsonrpc-events-buffer connection) + (cl-destructuring-bind (&key method id error &allow-other-keys) message + (let* ((inhibit-read-only t) + (subtype (cond ((and method id) 'request) + (method 'notification) + (id 'reply) + (t 'message))) + (type + (concat (format "%s" (or type 'internal)) + (if type + (format "-%s" subtype))))) + (goto-char (point-max)) + (prog1 + (let ((msg (format "%s%s%s %s:\n%s\n" + type + (if id (format " (id:%s)" id) "") + (if error " ERROR" "") + (current-time-string) + (pp-to-string message)))) + (when error + (setq msg (propertize msg 'face 'error))) + (insert-before-markers msg)) + ;; Trim the buffer if it's too large + (when max + (save-excursion + (goto-char (point-min)) + (while (> (buffer-size) max) + (delete-region (point) (progn (forward-line 1) + (forward-sexp 1) + (forward-line 2) + (point))))))))))))) (provide 'jsonrpc) ;;; jsonrpc.el ends here diff --git a/lisp/language/thai.el b/lisp/language/thai.el index c655845e95d..a896fe59fd1 100644 --- a/lisp/language/thai.el +++ b/lisp/language/thai.el @@ -36,7 +36,7 @@ "8-bit encoding for ASCII (MSB=0) and Thai TIS620 (MSB=1)." :coding-type 'charset :mnemonic ?T - :charset-list '(thai-iso8859-11)) + :charset-list '(tis620-2533)) (define-coding-system-alias 'th-tis620 'thai-tis620) (define-coding-system-alias 'tis620 'thai-tis620) @@ -47,7 +47,7 @@ (charset thai-tis620) (coding-system thai-tis620 iso-8859-11 cp874) (coding-priority thai-tis620) - (nonascii-translation . iso-8859-11) + (nonascii-translation . tis620-2533) (input-method . "thai-kesmanee") (unibyte-display . thai-tis620) (features thai-util) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 7bd1668cf4e..c85fe676da2 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -869,7 +869,11 @@ buffer where the user can select from the list." ;;;###autoload (defun xref-find-references (identifier) "Find references to the identifier at point. -With prefix argument, prompt for the identifier." +This command might prompt for the identifier as needed, perhaps +offering the symbol at point as the default. +With prefix argument, or if `xref-prompt-for-identifier' is t, +always prompt for the identifier. If `xref-prompt-for-identifier' +is nil, prompt only if there's no usable symbol at point." (interactive (list (xref--read-identifier "Find references of: "))) (xref--find-xrefs identifier 'references identifier nil)) diff --git a/lisp/startup.el b/lisp/startup.el index c1e56fcdff3..4eb71abaacf 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2534,9 +2534,9 @@ nil default-directory" name) ((eq initial-buffer-choice t) (get-buffer-create "*scratch*")) (t - (error "initial-buffer-choice must be a string, a function, or t."))))) + (error "`initial-buffer-choice' must be a string, a function, or t"))))) (unless (buffer-live-p buf) - (error "initial-buffer-choice is not a live buffer.")) + (error "Value returned by `initial-buffer-choice' is not a live buffer: %S" buf)) (setq displayable-buffers (cons buf (delq buf displayable-buffers))))) ;; Display the first two buffers in `displayable-buffers'. If diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 69bba100922..f6a809b18ee 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -1424,10 +1424,20 @@ determined by `flyspell-large-region'." The list of incorrect words should be in `flyspell-external-ispell-buffer'. \(We finish by killing that buffer and setting the variable to nil.) The buffer to mark them in is `flyspell-large-region-buffer'." - (let (words-not-found - (ispell-otherchars (ispell-get-otherchars)) - (buffer-scan-pos flyspell-large-region-beg) - case-fold-search) + (let* (words-not-found + (flyspell-casechars (flyspell-get-casechars)) + (ispell-otherchars (ispell-get-otherchars)) + (ispell-many-otherchars-p (ispell-get-many-otherchars-p)) + (word-chars (concat flyspell-casechars + "+\\(" + (if (not (string= "" ispell-otherchars)) + (concat ispell-otherchars "?")) + flyspell-casechars + "+\\)" + (if ispell-many-otherchars-p + "*" "?"))) + (buffer-scan-pos flyspell-large-region-beg) + case-fold-search) (with-current-buffer flyspell-external-ispell-buffer (goto-char (point-min)) ;; Loop over incorrect words, in the order they were reported, @@ -1457,11 +1467,18 @@ The buffer to mark them in is `flyspell-large-region-buffer'." ;; Move back into the match ;; so flyspell-get-word will find it. (forward-char -1) - (flyspell-get-word))) + ;; Is this a word that matches the + ;; current dictionary? + (if (looking-at word-chars) + (flyspell-get-word)))) (found (car found-list)) (found-length (length found)) (misspell-length (length word))) (when (or + ;; Misspelled word is not from the + ;; language supported by the current + ;; dictionary. + (null found) ;; Size matches, we really found it. (= found-length misspell-length) ;; Matches as part of a boundary-char separated @@ -1483,13 +1500,21 @@ The buffer to mark them in is `flyspell-large-region-buffer'." ;; backslash) and none of the previous ;; conditions match. (and (not ispell-really-aspell) + (not ispell-really-hunspell) + (not ispell-really-enchant) (save-excursion (goto-char (- (nth 1 found-list) 1)) (if (looking-at "[\\]" ) t nil)))) (setq keep nil) - (flyspell-word nil t) + ;; Don't try spell-checking words whose + ;; characters don't match CASECHARS, because + ;; flyspell-word will then consider as + ;; misspelling the preceding word that matches + ;; CASECHARS. + (or (null found) + (flyspell-word nil t)) ;; Search for next misspelled word will begin from ;; end of last validated match. (setq buffer-scan-pos (point)))) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index e6f436fa1a1..87bcb5d651a 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -1173,6 +1173,12 @@ dictionary from that list was found." ;; Parse and set values for default dictionary. (setq hunspell-default-dict (or hunspell-multi-dict (car hunspell-default-dict))) + ;; If hunspell-default-dict is nil, ispell-parse-hunspell-affix-file + ;; will barf with an error message that doesn't help users figure + ;; out what is wrong. Produce an error message that points to the + ;; root cause of the problem. + (or hunspell-default-dict + (error "Can't find Hunspell dictionary with a .aff affix file")) (setq hunspell-default-dict-entry (ispell-parse-hunspell-affix-file hunspell-default-dict)) ;; Create an alist of found dicts with only names, except for default dict. diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 55c0132bf2b..f1b622b54a9 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -692,24 +692,26 @@ visiting FILE. If BACKEND is passed use it as the VC backend when computing the result." (interactive (list buffer-file-name)) (setq backend (or backend (vc-backend file))) - (if (not backend) - (setq vc-mode nil) + (cond + ((not backend) + (setq vc-mode nil)) + ((null vc-display-status) + (setq vc-mode (concat " " (symbol-name backend)))) + (t (let* ((ml-string (vc-call-backend backend 'mode-line-string file)) (ml-echo (get-text-property 0 'help-echo ml-string))) (setq vc-mode (concat " " - (if (null vc-display-status) - (symbol-name backend) - (propertize - ml-string - 'mouse-face 'mode-line-highlight - 'help-echo - (concat (or ml-echo - (format "File under the %s version control system" - backend)) - "\nmouse-1: Version Control menu") - 'local-map vc-mode-line-map))))) + (propertize + ml-string + 'mouse-face 'mode-line-highlight + 'help-echo + (concat (or ml-echo + (format "File under the %s version control system" + backend)) + "\nmouse-1: Version Control menu") + 'local-map vc-mode-line-map)))) ;; If the user is root, and the file is not owner-writable, ;; then pretend that we can't write it ;; even though we can (because root can write anything). @@ -718,7 +720,7 @@ If BACKEND is passed use it as the VC backend when computing the result." (not buffer-read-only) (zerop (user-real-uid)) (zerop (logand (file-modes buffer-file-name) 128)) - (setq buffer-read-only t))) + (setq buffer-read-only t)))) (force-mode-line-update) backend) diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index bdba32c8067..a8a41c453a0 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -279,7 +279,7 @@ bit output with no translation." (w32-add-charset-info "iso8859-9" 'w32-charset-turkish 1254) (w32-add-charset-info "iso8859-13" 'w32-charset-baltic 1257) (w32-add-charset-info "koi8-r" 'w32-charset-russian 20866) - (w32-add-charset-info "iso8859-5" 'w32-charset-russian 28595) + (w32-add-charset-info "tis620-2533" 'w32-charset-russian 28595) (w32-add-charset-info "iso8859-11" 'w32-charset-thai 874) (w32-add-charset-info "windows-1258" 'w32-charset-vietnamese 1258) (w32-add-charset-info "ksc5601.1992" 'w32-charset-johab 1361) |