diff options
author | Glenn Morris <rgm@gnu.org> | 2018-09-10 13:12:38 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2018-09-10 13:12:38 -0700 |
commit | 0407733ef3d4e8e133e91917097dbc9bcc688b47 (patch) | |
tree | 9223757d1d54460b3ca0e7867636072a51cd55f2 | |
parent | 6e050694f247671e67c1eabace36cf9792ab4451 (diff) | |
parent | 7efcdf7b3e70f0334caa328cbb5b05a4e30099bd (diff) | |
download | emacs-0407733ef3d4e8e133e91917097dbc9bcc688b47.tar.gz |
Merge from origin/emacs-26
7efcdf7 (origin/emacs-26) Clarify completion text in the ELisp manual
30b0b0e Fix handling of abbreviated control command in gdb-mi.el
5cf282d Clarify documentation of functions reading character events
96281c5 Record :version for built-in variables while dumping
82160cf * src/process.c (connect_network_socket): Fix memory leak. (...
6c616e4 * Makefile.in (appdatadir): Use the non-obsolete location "me...
9618e16 Better fix for bug#32550
30d94e4 Fix Bug#32550
57bcdc7 Don't call XGetGeometry for frames without outer X window (Bu...
82fc6b6 * lisp/calculator.el: Fix doc typo.
ddc7c64 Standardize calc bug reporting instructions
Conflicts:
lisp/cus-start.el
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | doc/lispref/commands.texi | 64 | ||||
-rw-r--r-- | doc/lispref/help.texi | 14 | ||||
-rw-r--r-- | doc/lispref/minibuf.texi | 9 | ||||
-rw-r--r-- | doc/misc/calc.texi | 15 | ||||
-rw-r--r-- | lisp/calc/calc-misc.el | 16 | ||||
-rw-r--r-- | lisp/calc/calc.el | 4 | ||||
-rw-r--r-- | lisp/calculator.el | 2 | ||||
-rw-r--r-- | lisp/cus-start.el | 3 | ||||
-rw-r--r-- | lisp/net/tramp.el | 41 | ||||
-rw-r--r-- | lisp/progmodes/gdb-mi.el | 5 | ||||
-rw-r--r-- | lisp/rfn-eshadow.el | 4 | ||||
-rw-r--r-- | src/keymap.c | 17 | ||||
-rw-r--r-- | src/lread.c | 20 | ||||
-rw-r--r-- | src/process.c | 18 | ||||
-rw-r--r-- | src/xfns.c | 2 |
16 files changed, 127 insertions, 109 deletions
diff --git a/Makefile.in b/Makefile.in index 4d7627ba09d..5ea48824bd3 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 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/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index d091787a680..da3ebd89aa2 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1776,12 +1776,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 diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 02deee99e19..446210e5ff4 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. -" ))) -;;;###autoload -(defalias 'calc-report-bug 'report-calc-bug) +(define-obsolete-function-alias 'report-calc-bug 'report-emacs-bug "26.2") +;;;###autoload +(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 364b44bfcfe..c79db821eb6 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. 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 diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 1a5b3caea23..88a61753f25 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -711,6 +711,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)) ;; Don't re-add to custom-delayed-init-variables post-startup. (unless after-init-time ;; Note this is the _only_ initialize property we handle. @@ -731,7 +733,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) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 07154b57f20..567701a9b28 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1954,7 +1954,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) @@ -1964,11 +1963,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. @@ -1986,6 +1985,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 @@ -1993,26 +1999,25 @@ 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)) + (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))))))) (add-hook 'rfn-eshadow-update-overlay-hook 'tramp-rfn-eshadow-update-overlay) @@ -4666,8 +4671,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 diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 6fee895e6a0..da979de5400 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1780,9 +1780,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 diff --git a/lisp/rfn-eshadow.el b/lisp/rfn-eshadow.el index 41fd8b5f97d..d6e9a1efae1 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 diff --git a/src/keymap.c b/src/keymap.c index 79dce15a812..e405ed8c827 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2216,10 +2216,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; @@ -2293,11 +2295,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 e43929a8c6a..73e38d89954 100644 --- a/src/lread.c +++ b/src/lread.c @@ -741,10 +741,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 @@ -791,10 +795,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 diff --git a/src/process.c b/src/process.c index ebaaf33e57f..4d96e469767 100644 --- a/src/process.c +++ b/src/process.c @@ -3331,11 +3331,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 UNINIT; struct Lisp_Process *p = XPROCESS (proc); @@ -3354,6 +3352,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); @@ -3366,9 +3369,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; @@ -3530,7 +3532,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) @@ -3601,6 +3603,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; } @@ -3620,7 +3623,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); @@ -3681,6 +3684,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos, } #endif + unbind_to (count, Qnil); } /* Create a network stream/datagram client/server process. Treated diff --git a/src/xfns.c b/src/xfns.c index e19fcff9b05..c4cf59d9b27 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5075,7 +5075,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 (); |