From ddc7c648d2cba328f8812c678fbae23d96dfaf49 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 3 Sep 2018 10:28:07 -0700 Subject: [PATCH 01/11] Standardize calc bug reporting instructions * doc/misc/calc.texi (Reporting Bugs): Use standard commands. * lisp/calc/calc-misc.el (report-calc-bug, calc-report-bug): * lisp/calc/calc.el (calc-bug-address): Change to be obsolete aliases for standard Emacs bug reporting items. --- doc/misc/calc.texi | 15 ++++----------- lisp/calc/calc-misc.el | 14 ++------------ lisp/calc/calc.el | 4 ++-- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 9f821baf60f..5e11d35e90e 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -35724,19 +35724,12 @@ The default value of @code{calc-gregorian-switch} is @code{nil}. @appendix Reporting Bugs @noindent -If you find a bug in Calc, send e-mail to Jay Belanger, - -@example -jay.p.belanger@@gmail.com -@end example - -@noindent -There is an automatic command @kbd{M-x report-calc-bug} which helps +If you find a bug in Calc, send e-mail to @email{bug-gnu-emacs@@gnu.org}. +There is an automatic command @kbd{M-x report-emacs-bug} which helps you to report bugs. This command prompts you for a brief subject line, then leaves you in a mail editing buffer. Type @kbd{C-c C-c} to send your mail. Make sure your subject line indicates that you are -reporting a Calc bug; this command sends mail to the maintainer's -regular mailbox. +reporting a Calc bug. If you have suggestions for additional features for Calc, please send them. Some have dared to suggest that Calc is already top-heavy with @@ -35745,7 +35738,7 @@ them right in. At the front of the source file, @file{calc.el}, is a list of ideas for future work. If any enthusiastic souls wish to take it upon themselves -to work on these, please send a message (using @kbd{M-x report-calc-bug}) +to work on these, please send a message (using @kbd{M-x report-emacs-bug}) so any efforts can be coordinated. The latest version of Calc is available from Savannah, in the Emacs diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el index 29e85104131..6543920d07e 100644 --- a/lisp/calc/calc-misc.el +++ b/lisp/calc/calc-misc.el @@ -943,19 +943,9 @@ loaded and the keystroke automatically re-typed." ;;; Bug reporting ;;;###autoload -(defun report-calc-bug () - "Report a bug in Calc, the GNU Emacs calculator. -Prompts for bug subject. Leaves you in a mail buffer." - (interactive) - (let ((reporter-prompt-for-summary-p t)) - (reporter-submit-bug-report calc-bug-address "Calc" - nil nil nil - "Please describe exactly what actions triggered the bug and the -precise symptoms of the bug. If possible, include a backtrace by -doing `\\[toggle-debug-on-error]', then reproducing the bug. -" ))) +(define-obsolete-function-alias 'report-calc-bug 'report-emacs-bug "26.2") ;;;###autoload -(defalias 'calc-report-bug 'report-calc-bug) +(define-obsolete-function-alias 'calc-report-bug 'report-emacs-bug "26.2") (provide 'calc-misc) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 4bebd5f47b7..871e65a2cba 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -486,8 +486,8 @@ to be identified as that note." "Face used to show the selected portion of a formula." :group 'calc) -(defvar calc-bug-address "emacs-devel@gnu.org" - "Address of the maintainer of Calc, for use by `report-calc-bug'.") +(define-obsolete-variable-alias 'calc-bug-address 'report-emacs-bug-address + "26.2") (defvar calc-scan-for-dels t "If t, scan keymaps to find all DEL-like keys. From 82fc6b631306bd42f29a189a3cc9e8f449fa7501 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 3 Sep 2018 12:57:10 -0700 Subject: [PATCH 02/11] * lisp/calculator.el: Fix doc typo. --- lisp/calculator.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/calculator.el b/lisp/calculator.el index b6959af795a..f559fb48284 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -627,7 +627,7 @@ Here are the editing keys: These operators are pre-defined: * `+' `-' `*' `/' the common binary operators -* `\\' `%' integer division and reminder +* `\\' `%' integer division and remainder * `_' `;' postfix unary negation and reciprocal * `^' `L' binary operators for x^y and log(x) in base y * `Q' `!' unary square root and factorial From 57bcdc76e0518f53cd171c76e726e6bdf646bf9a Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Tue, 4 Sep 2018 08:53:49 +0200 Subject: [PATCH 03/11] Don't call XGetGeometry for frames without outer X window (Bug#32615) * src/xfns.c (frame_geometry): Don't call XGetGeometry when FRAME has no outer X window; return nil instead. (Bug#32615) --- src/xfns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xfns.c b/src/xfns.c index 3da853ede8a..1381fee57ee 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5054,7 +5054,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute) int menu_bar_height = 0, menu_bar_width = 0; int tool_bar_height = 0, tool_bar_width = 0; - if (FRAME_INITIAL_P (f) || !FRAME_X_P (f)) + if (FRAME_INITIAL_P (f) || !FRAME_X_P (f) || !FRAME_OUTER_WINDOW (f)) return Qnil; block_input (); From 30d94e4b926fb62c4cb0d2635c7bb6b580c68c4a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 4 Sep 2018 11:59:39 +0200 Subject: [PATCH 04/11] Fix Bug#32550 * lisp/net/tramp.el (tramp-rfn-eshadow-setup-minibuffer): Do not use `symbol-value'. (tramp-rfn-eshadow-update-overlay): Do not use `symbol-value'. Do not let-bind `rfn-eshadow-overlay', assign it directly (due to lexical binding). (Bug#32550) --- lisp/net/tramp.el | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 13447575599..22fcccb8b65 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1892,7 +1892,6 @@ For definition of that list see `tramp-set-completion-function'." ;; The method related defaults. (cdr (assoc method tramp-completion-function-alist)))) - ;;; Fontification of `read-file-name': (defvar tramp-rfn-eshadow-overlay) @@ -1902,11 +1901,11 @@ For definition of that list see `tramp-set-completion-function'." "Set up a minibuffer for `file-name-shadow-mode'. Adds another overlay hiding filename parts according to Tramp's special handling of `substitute-in-file-name'." - (when (symbol-value 'minibuffer-completing-file-name) + (when minibuffer-completing-file-name (setq tramp-rfn-eshadow-overlay (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) ;; Copy rfn-eshadow-overlay properties. - (let ((props (overlay-properties (symbol-value 'rfn-eshadow-overlay)))) + (let ((props (overlay-properties rfn-eshadow-overlay))) (while props ;; The `field' property prevents correct minibuffer ;; completion; we exclude it. @@ -1931,26 +1930,24 @@ This is intended to be used as a minibuffer `post-command-hook' for been set up by `rfn-eshadow-setup-minibuffer'." ;; In remote files name, there is a shadowing just for the local part. (ignore-errors - (let ((end (or (overlay-end (symbol-value 'rfn-eshadow-overlay)) + (let ((end (or (overlay-end rfn-eshadow-overlay) (minibuffer-prompt-end))) ;; We do not want to send any remote command. (non-essential t)) (when (tramp-tramp-file-p (buffer-substring-no-properties end (point-max))) - (save-excursion - (save-restriction - (narrow-to-region - (1+ (or (string-match - (tramp-rfn-eshadow-update-overlay-regexp) - (buffer-string) end) - end)) - (point-max)) - (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) - (rfn-eshadow-update-overlay-hook nil) - file-name-handler-alist) - (move-overlay rfn-eshadow-overlay (point-max) (point-max)) - (rfn-eshadow-update-overlay)))))))) + (save-restriction + (narrow-to-region + (1+ (or (string-match + (tramp-rfn-eshadow-update-overlay-regexp) + (buffer-string) end) + end)) + (point-max)) + (setq rfn-eshadow-overlay tramp-rfn-eshadow-overlay) + (let (rfn-eshadow-update-overlay-hook file-name-handler-alist) + (move-overlay rfn-eshadow-overlay (point-max) (point-max)) + (rfn-eshadow-update-overlay))))))) (add-hook 'rfn-eshadow-update-overlay-hook 'tramp-rfn-eshadow-update-overlay) @@ -4616,8 +4613,6 @@ Only works for Bourne-like shells." ;; strange when doing zerop, we should kill the process and start ;; again. (Greg Stark) ;; -;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846) -;; ;; * I was wondering if it would be possible to use tramp even if I'm ;; actually using sshfs. But when I launch a command I would like ;; to get it executed on the remote machine where the files really From 9618e16efa5607664b794795fb80bdf5862fbe4b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 4 Sep 2018 12:03:52 -0400 Subject: [PATCH 05/11] Better fix for bug#32550 * lisp/rfn-eshadow.el (rfn-eshadow-overlay): Give it a global default. * lisp/net/tramp.el (rfn-eshadow-overlay): Declare it as dynamically scoped. (tramp-rfn-eshadow-update-overlay): Revert the corresponding part of last change. --- lisp/net/tramp.el | 12 ++++++++++-- lisp/rfn-eshadow.el | 4 +--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 22fcccb8b65..452e70ec353 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1923,6 +1923,13 @@ special handling of `substitute-in-file-name'." (defun tramp-rfn-eshadow-update-overlay-regexp () (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format)) +;; Package rfn-eshadow is preloaded in Emacs, but for some reason, +;; it only did (defvar rfn-eshadow-overlay) without giving it a global +;; value, so it was only declared as dynamically-scoped within the +;; rfn-eshadow.el file. This is now fixed in Emacs>26.1 but we still need +;; this defvar here for older releases. +(defvar rfn-eshadow-overlay) + (defun tramp-rfn-eshadow-update-overlay () "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input. This is intended to be used as a minibuffer `post-command-hook' for @@ -1944,8 +1951,9 @@ been set up by `rfn-eshadow-setup-minibuffer'." (buffer-string) end) end)) (point-max)) - (setq rfn-eshadow-overlay tramp-rfn-eshadow-overlay) - (let (rfn-eshadow-update-overlay-hook file-name-handler-alist) + (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) + (rfn-eshadow-update-overlay-hook nil) + file-name-handler-alist) (move-overlay rfn-eshadow-overlay (point-max) (point-max)) (rfn-eshadow-update-overlay))))))) diff --git a/lisp/rfn-eshadow.el b/lisp/rfn-eshadow.el index 847db68a776..cf719966605 100644 --- a/lisp/rfn-eshadow.el +++ b/lisp/rfn-eshadow.el @@ -132,9 +132,7 @@ system, `file-name-shadow-properties' is used instead." ;; An overlay covering the shadowed part of the filename (local to the ;; minibuffer). -(defvar rfn-eshadow-overlay) -(make-variable-buffer-local 'rfn-eshadow-overlay) - +(defvar-local rfn-eshadow-overlay nil) ;;; Hook functions From 6c616e465cc83cf376d4df75f9c4afdbdf0ef6ca Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 5 Sep 2018 16:37:56 -0400 Subject: [PATCH 06/11] * Makefile.in (appdatadir): Use the non-obsolete location "metainfo". ; https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html ; "AppStream tools scan the /usr/share/appdata/ path for legacy ; compatibility as well. It should not be used anymore by new ; software though, even on older Linux distributions (like RHEL 7 ; and Ubuntu 16.04 LTS) the metainfo path is well supported. Support ; for the legacy path might be dropped completely in future." --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 238df40ded8..19bf7c423ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -192,7 +192,7 @@ x_default_search_path=@x_default_search_path@ desktopdir=$(datarootdir)/applications # Where the etc/emacs.appdata.xml file is to be installed. -appdatadir=$(datarootdir)/appdata +appdatadir=$(datarootdir)/metainfo # Where the etc/emacs.service file is to be installed. # The system value (typically /usr/lib/systemd/user) can be From 82160cf0c16e22bddfd90254e4a4e03ed383c9ae Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Fri, 7 Sep 2018 08:35:36 +0900 Subject: [PATCH 07/11] * src/process.c (connect_network_socket): Fix memory leak. (Bug#32604) --- src/process.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/process.c b/src/process.c index 676f38446e4..b0a327229c6 100644 --- a/src/process.c +++ b/src/process.c @@ -3321,11 +3321,9 @@ static void connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, Lisp_Object use_external_socket_p) { - ptrdiff_t count = SPECPDL_INDEX (); int s = -1, outch, inch; int xerrno = 0; int family; - struct sockaddr *sa = NULL; int ret; ptrdiff_t addrlen; struct Lisp_Process *p = XPROCESS (proc); @@ -3344,6 +3342,11 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, /* Do this in case we never enter the while-loop below. */ s = -1; + struct sockaddr *sa = NULL; + ptrdiff_t count = SPECPDL_INDEX (); + record_unwind_protect_nothing (); + ptrdiff_t count1 = SPECPDL_INDEX (); + while (!NILP (addrinfos)) { Lisp_Object addrinfo = XCAR (addrinfos); @@ -3356,9 +3359,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, #endif addrlen = get_lisp_to_sockaddr_size (ip_address, &family); - if (sa) - free (sa); - sa = xmalloc (addrlen); + sa = xrealloc (sa, addrlen); + set_unwind_protect_ptr (count, xfree, sa); conv_lisp_to_sockaddr (family, ip_address, sa, addrlen); s = socket_to_use; @@ -3520,7 +3522,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, #endif /* !WINDOWSNT */ /* Discard the unwind protect closing S. */ - specpdl_ptr = specpdl + count; + specpdl_ptr = specpdl + count1; emacs_close (s); s = -1; if (0 <= socket_to_use) @@ -3591,6 +3593,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, Lisp_Object data = get_file_errno_data (err, contact, xerrno); pset_status (p, list2 (Fcar (data), Fcdr (data))); + unbind_to (count, Qnil); return; } @@ -3610,7 +3613,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, p->outfd = outch; /* Discard the unwind protect for closing S, if any. */ - specpdl_ptr = specpdl + count; + specpdl_ptr = specpdl + count1; if (p->is_server && p->socktype != SOCK_DGRAM) pset_status (p, Qlisten); @@ -3671,6 +3674,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, } #endif + unbind_to (count, Qnil); } /* Create a network stream/datagram client/server process. Treated From 96281c5ee1582ac0c329d09797ab7ab3dbae26d1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 7 Sep 2018 10:35:59 +0300 Subject: [PATCH 08/11] Record :version for built-in variables while dumping * lisp/cus-start.el (standard): Record the ':version; of the symbols when dumping, so that 'describe-variable' could tell which built-in variables were added/changed in recent versions. --- lisp/cus-start.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 451e7f762f4..8ed0f805d01 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -706,6 +706,8 @@ since it could result in memory overflow and make Emacs crash." (put symbol 'risky-local-variable (cadr prop))) (if (setq prop (memq :set rest)) (put symbol 'custom-set (cadr prop))) + ;; This is used by describe-variable. + (if version (put symbol 'custom-version version)) ;; Note this is the _only_ initialize property we handle. (if (eq (cadr (memq :initialize rest)) 'custom-initialize-delay) ;; These vars are defined early and should hence be initialized @@ -724,7 +726,6 @@ since it could result in memory overflow and make Emacs crash." (custom-add-to-group group symbol 'custom-variable)) ;; Set the type. (put symbol 'custom-type type) - (if version (put symbol 'custom-version version)) (while rest (setq prop (car rest) propval (cadr rest) From 5cf282d65f10f59f7efa63359dfd2b2e124943da Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 10 Sep 2018 12:46:22 +0300 Subject: [PATCH 09/11] Clarify documentation of functions reading character events * doc/lispref/help.texi (Describing Characters): * doc/lispref/commands.texi (Keyboard Events) (Reading One Event, Classifying Events): Make the distinction between characters and character events more explicit. * src/keymap.c (Ftext_char_description) (Fsingle_key_description): * src/lread.c (Fread_char, Fread_char_exclusive): Doc fixes, to make a clear distinction between a character input event and a character code. (Bug#32562) --- doc/lispref/commands.texi | 64 +++++++++++++++++++++++++-------------- doc/lispref/help.texi | 14 ++++----- src/keymap.c | 17 ++++++----- src/lread.c | 20 ++++++++---- 4 files changed, 73 insertions(+), 42 deletions(-) diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 0753d6fb67c..3e74f05e4c8 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -1076,9 +1076,10 @@ the current Emacs session. If a symbol has not yet been so used, @cindex keyboard events There are two kinds of input you can get from the keyboard: ordinary -keys, and function keys. Ordinary keys correspond to characters; the -events they generate are represented in Lisp as characters. The event -type of a character event is the character itself (an integer); see +keys, and function keys. Ordinary keys correspond to (possibly +modified) characters; the events they generate are represented in Lisp +as characters. The event type of a character event is the character +itself (an integer), which might have some modifier bits set; see @ref{Classifying Events}. @cindex modifier bits (of input character) @@ -1123,7 +1124,7 @@ for @kbd{%} plus 2**26 @end ifnottex (assuming the terminal supports non-@acronym{ASCII} -control characters). +control characters), i.e.@: with the 27th bit set. @item shift The @@ -1133,8 +1134,8 @@ The @ifnottex 2**25 @end ifnottex -bit in the character code indicates an @acronym{ASCII} control -character typed with the shift key held down. +bit (the 26th bit) in the character event code indicates an +@acronym{ASCII} control character typed with the shift key held down. For letters, the basic code itself indicates upper versus lower case; for digits and punctuation, the shift key selects an entirely different @@ -1146,7 +1147,7 @@ character with a different basic code. In order to keep within the @ifnottex 2**25 @end ifnottex -bit for those characters. +bit for those character events. However, @acronym{ASCII} provides no way to distinguish @kbd{C-A} from @kbd{C-a}, so Emacs uses the @@ -1167,7 +1168,7 @@ The @ifnottex 2**24 @end ifnottex -bit in the character code indicates a character +bit in the character event code indicates a character typed with the hyper key held down. @item super @@ -1178,7 +1179,7 @@ The @ifnottex 2**23 @end ifnottex -bit in the character code indicates a character +bit in the character event code indicates a character typed with the super key held down. @item alt @@ -1189,9 +1190,9 @@ The @ifnottex 2**22 @end ifnottex -bit in the character code indicates a character typed with the alt key -held down. (The key labeled @key{Alt} on most keyboards is actually -treated as the meta key, not this.) +bit in the character event code indicates a character typed with the +alt key held down. (The key labeled @key{Alt} on most keyboards is +actually treated as the meta key, not this.) @end table It is best to avoid mentioning specific bit numbers in your program. @@ -1949,6 +1950,10 @@ Here are some examples: The modifiers list for a click event explicitly contains @code{click}, but the event symbol name itself does not contain @samp{click}. +Similarly, the modifiers list for an @acronym{ASCII} control +character, such as @samp{C-a}, contains @code{control}, even though +reading such an event via @code{read-char} will return the value 1 +with the control modifier bit removed. @end defun @defun event-basic-type event @@ -2545,17 +2550,31 @@ right-arrow function key: @end defun @defun read-char &optional prompt inherit-input-method seconds -This function reads and returns a character of command input. If the +This function reads and returns a character input event. If the user generates an event which is not a character (i.e., a mouse click or function key event), @code{read-char} signals an error. The arguments work as in @code{read-event}. -In the first example, the user types the character @kbd{1} (@acronym{ASCII} -code 49). The second example shows a keyboard macro definition that -calls @code{read-char} from the minibuffer using @code{eval-expression}. -@code{read-char} reads the keyboard macro's very next character, which -is @kbd{1}. Then @code{eval-expression} displays its return value in -the echo area. +If the event has modifiers, Emacs attempts to resolve them and return +the code of the corresponding character. For example, if the user +types @kbd{C-a}, the function returns 1, which is the @acronym{ASCII} +code of the @samp{C-a} character. If some of the modifiers cannot be +reflected in the character code, @code{read-char} leaves the +unresolved modifier bits set in the returned event. For example, if +the user types @kbd{C-M-a}, the function returns 134217729, 8000001 in +hex, i.e.@: @samp{C-a} with the Meta modifier bit set. This value is +not a valid character code: it fails the @code{characterp} test +(@pxref{Character Codes}). Use @code{event-basic-type} +(@pxref{Classifying Events}) to recover the character code with the +modifier bits removed; use @code{event-modifiers} to test for +modifiers in the character event returned by @code{read-char}. + +In the first example below, the user types the character @kbd{1} +(@acronym{ASCII} code 49). The second example shows a keyboard macro +definition that calls @code{read-char} from the minibuffer using +@code{eval-expression}. @code{read-char} reads the keyboard macro's +very next character, which is @kbd{1}. Then @code{eval-expression} +displays its return value in the echo area. @example @group @@ -2577,10 +2596,11 @@ the echo area. @end defun @defun read-char-exclusive &optional prompt inherit-input-method seconds -This function reads and returns a character of command input. If the -user generates an event which is not a character, +This function reads and returns a character input event. If the +user generates an event which is not a character event, @code{read-char-exclusive} ignores it and reads another event, until it -gets a character. The arguments work as in @code{read-event}. +gets a character. The arguments work as in @code{read-event}. The +returned value may include modifier bits, as with @code{read-char}. @end defun None of the above functions suppress quitting. diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 6dd55d0b256..a23bc413d25 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi @@ -556,13 +556,13 @@ brackets. @defun text-char-description character This function returns a string describing @var{character} in the -standard Emacs notation for characters that appear in text---like -@code{single-key-description}, except that control characters are -represented with a leading caret (which is how control characters in -Emacs buffers are usually displayed). Another difference is that -@code{text-char-description} recognizes the 2**7 bit as the Meta -character, whereas @code{single-key-description} uses the 2**27 bit -for Meta. +standard Emacs notation for characters that can appear in text---like +@code{single-key-description}, except that the argument must be a +valid character code that passes a @code{characterp} test +(@pxref{Character Codes}), control characters are represented with a +leading caret (which is how control characters in Emacs buffers are +usually displayed), and the 2**7 bit is treated as the Meta bit, +whereas @code{single-key-description} uses the 2**27 bit for Meta. @smallexample @group diff --git a/src/keymap.c b/src/keymap.c index c8cc933e782..ec483c7a632 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2205,10 +2205,12 @@ push_key_description (EMACS_INT ch, char *p) DEFUN ("single-key-description", Fsingle_key_description, Ssingle_key_description, 1, 2, 0, - doc: /* Return a pretty description of command character KEY. + doc: /* Return a pretty description of a character event KEY. Control characters turn into C-whatever, etc. Optional argument NO-ANGLES non-nil means don't put angle brackets -around function keys and event symbols. */) +around function keys and event symbols. + +See `text-char-description' for describing character codes. */) (Lisp_Object key, Lisp_Object no_angles) { USE_SAFE_ALLOCA; @@ -2282,11 +2284,12 @@ push_text_char_description (register unsigned int c, register char *p) /* This function cannot GC. */ DEFUN ("text-char-description", Ftext_char_description, Stext_char_description, 1, 1, 0, - doc: /* Return a pretty description of file-character CHARACTER. -Control characters turn into "^char", etc. This differs from -`single-key-description' which turns them into "C-char". -Also, this function recognizes the 2**7 bit as the Meta character, -whereas `single-key-description' uses the 2**27 bit for Meta. + doc: /* Return the description of CHARACTER in standard Emacs notation. +CHARACTER must be a valid character code that passes the `characterp' test. +Control characters turn into "^char", the 2**7 bit is treated as Meta, etc. +This differs from `single-key-description' which accepts character events, +and thus doesn't enforce the `characterp' condition, turns control +characters into "C-char", and uses the 2**27 bit for Meta. See Info node `(elisp)Describing Characters' for examples. */) (Lisp_Object character) { diff --git a/src/lread.c b/src/lread.c index d5ba48a170d..2e5cba510c5 100644 --- a/src/lread.c +++ b/src/lread.c @@ -735,10 +735,14 @@ read_filtered_event (bool no_switch_frame, bool ascii_required, } DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0, - doc: /* Read a character from the command input (keyboard or macro). + doc: /* Read a character event from the command input (keyboard or macro). It is returned as a number. -If the character has modifiers, they are resolved and reflected to the -character code if possible (e.g. C-SPC -> 0). +If the event has modifiers, they are resolved and reflected in the +returned character code if possible (e.g. C-SPC yields 0 and C-a yields 97). +If some of the modifiers cannot be reflected in the character code, the +returned value will include those modifiers, and will not be a valid +character code: it will fail the `characterp' test. Use `event-basic-type' +to recover the character code with the modifiers removed. If the user generates an event which is not a character (i.e. a mouse click or function key event), `read-char' signals an error. As an @@ -785,10 +789,14 @@ floating-point value. */) } DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, 0, - doc: /* Read a character from the command input (keyboard or macro). + doc: /* Read a character event from the command input (keyboard or macro). It is returned as a number. Non-character events are ignored. -If the character has modifiers, they are resolved and reflected to the -character code if possible (e.g. C-SPC -> 0). +If the event has modifiers, they are resolved and reflected in the +returned character code if possible (e.g. C-SPC yields 0 and C-a yields 97). +If some of the modifiers cannot be reflected in the character code, the +returned value will include those modifiers, and will not be a valid +character code: it will fail the `characterp' test. Use `event-basic-type' +to recover the character code with the modifiers removed. If the optional argument PROMPT is non-nil, display that as a prompt. If the optional argument INHERIT-INPUT-METHOD is non-nil and some From 30b0b0e2e20fe2b944aec4be816aab2cf489eb91 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 10 Sep 2018 16:11:05 +0300 Subject: [PATCH 10/11] Fix handling of abbreviated control command in gdb-mi.el * lisp/progmodes/gdb-mi.el (gdb-control-commands-regexp): Support unambiguous abbreviations of commands. (Bug#32576) --- lisp/progmodes/gdb-mi.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 32d5ced67d0..0506386a75d 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1782,9 +1782,10 @@ static char *magick[] = { (defvar gdb-control-commands-regexp (concat "^\\(" - "commands\\|if\\|while\\|define\\|document\\|" + "comm\\(a\\(n\\(ds?\\)?\\)?\\)?\\|if\\|while" + "\\|def\\(i\\(ne?\\)?\\)?\\|doc\\(u\\(m\\(e\\(nt?\\)?\\)?\\)?\\)?\\|" gdb-python-guile-commands-regexp - "\\|while-stepping\\|stepping\\|ws\\|actions" + "\\|while-stepping\\|stepp\\(i\\(ng?\\)?\\)?\\|ws\\|actions" "\\)\\([[:blank:]]+\\([^[:blank:]]*\\)\\)?$") "Regexp matching GDB commands that enter a recursive reading loop. As long as GDB is in the recursive reading loop, it does not expect From 7efcdf7b3e70f0334caa328cbb5b05a4e30099bd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 10 Sep 2018 16:20:42 +0300 Subject: [PATCH 11/11] Clarify completion text in the ELisp manual * doc/lispref/minibuf.texi (Programmed Completion): Clarify text. Suggested by Stefan Monnier . --- doc/lispref/minibuf.texi | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 1d1c93dd144..8fac1c3e762 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1770,12 +1770,9 @@ flag may be one of the following values. @table @code @item nil This specifies a @code{try-completion} operation. The function should -return @code{t} if the specified string is a unique and exact match; -if there is more than one match, it should return the common substring -of all matches (if the string is an exact match for one completion -alternative but also matches other longer alternatives, the return -value is the string); if there are no matches, it should return -@code{nil}. +return @code{nil} if there are no matches; it should return @code{t} +if the specified string is a unique and exact match; and it should +return the longest common prefix substring of all matches otherwise. @item t This specifies an @code{all-completions} operation. The function