emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 1ac0cfa: Merge from origin/emacs-26


From: Glenn Morris
Subject: [Emacs-diffs] master 1ac0cfa: Merge from origin/emacs-26
Date: Wed, 31 Jul 2019 00:42:44 -0400 (EDT)

branch: master
commit 1ac0cfa2642ac026e09a7555f000e895b49289d5
Merge: 77fb84e 8fbe462
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Merge from origin/emacs-26
    
    8fbe462 (origin/emacs-26) ; * doc/lispref/positions.texi (List Motion...
    1d9efc0 Add index for "\( in strings" (Bug#25195)
    304e96f Fix doc-string of 'fit-window-to-buffer' (Bug#36848)
    d4c4987 Update view-mode docstring
    d6ca1fc ; * lisp/term.el: Add missing / to esc seq commentary.
    b3e2073 Fix subproc listening when setting filter to non-t (Bug#36591)
    f671950 * etc/NEWS.25: Belatedly announce rcirc-reconnect-delay.
    7f42277 Mention term.el's \032 dir tracking in commentary (Bug#19524)
    16a529e Remove upload functionality of package-x from the elisp manual
    78e6c2a * etc/AUTHORS: Update.
    086a56e Clarify Gravatar docs
    0592467 * doc/lispref/display.texi (Defining Faces): Say a face can't...
    
    # Conflicts:
    #   doc/emacs/programs.texi
    #   etc/AUTHORS
    #   lisp/term.el
---
 doc/lispref/display.texi     |   5 ++
 doc/lispref/package.texi     |  35 ------------
 doc/lispref/positions.texi   |   6 +-
 doc/misc/gnus.texi           |  26 +++++----
 etc/NEWS.25                  |   5 ++
 lisp/emacs-lisp/package-x.el |  13 ++++-
 lisp/gnus/gnus-gravatar.el   |   3 +-
 lisp/image/gravatar.el       |  35 +++++++++---
 lisp/term.el                 | 131 +++++++++++++++++--------------------------
 lisp/view.el                 |   4 +-
 lisp/window.el               |   2 +-
 src/process.c                |  15 ++++-
 test/src/process-tests.el    |  29 ++++++++++
 13 files changed, 167 insertions(+), 142 deletions(-)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index cf0008d..42f838b 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2523,6 +2523,11 @@ face name.  In the vast majority of cases, this is not 
necessary; the
 usual procedure is to define a face with @code{defface}, and then use
 its name directly.
 
+@cindex face (non-removability of)
+Note that once you have defined a face (usually with @code{defface}),
+you cannot later undefine this face safely, except by restarting
+Emacs.
+
 @defmac defface face spec doc [keyword value]@dots{}
 This macro declares @var{face} as a named face whose default face spec
 is given by @var{spec}.  You should not quote the symbol @var{face},
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index 7244efb..a2f4f55 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -321,41 +321,6 @@ reachable via HTTP, this directory must be accessible to a 
web server;
 by default; type @kbd{M-x load-library @key{RET} package-x @key{RET}} to
 load it, or add @code{(require 'package-x)} to your init file.
 @xref{Lisp Libraries,, Lisp Libraries, emacs, The GNU Emacs Manual}.
-Once loaded, you can make use of the following:
-
-@defopt package-archive-upload-base
-The value of this variable is the base location of a package archive,
-as a directory name.  The commands in the @code{package-x} library
-will use this base location.
-
-The directory name should be absolute.  You may specify a remote name,
-such as @file{/ssh:foo@@example.com:/var/www/packages/}, if the
-package archive is on a different machine.  @xref{Remote Files,,
-Remote Files, emacs, The GNU Emacs Manual}.
-@end defopt
-
-@deffn Command package-upload-file filename
-This command prompts for @var{filename}, a file name, and uploads that
-file to @code{package-archive-upload-base}.  The file must be either a
-simple package (a @file{.el} file) or a multi-file package (a
-@file{.tar} file); otherwise, an error is raised.  The package
-attributes are automatically extracted, and the archive's contents
-list is updated with this information.
-
-If @code{package-archive-upload-base} does not specify a valid
-directory, the function prompts interactively for one.  If the
-directory does not exist, it is created.  The directory need not have
-any initial contents (i.e., you can use this command to populate an
-initially empty archive).
-@end deffn
-
-@deffn Command package-upload-buffer
-This command is similar to @code{package-upload-file}, but instead of
-prompting for a package file, it uploads the contents of the current
-buffer.  The current buffer must be visiting a simple package (a
-@file{.el} file) or a multi-file package (a @file{.tar} file);
-otherwise, an error is raised.
-@end deffn
 
 @noindent
 After you create an archive, remember that it is not accessible in the
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 7707793..cd9587b 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -794,11 +794,15 @@ on a line that starts with a match for this regular 
expression,
 followed by a character with open-parenthesis syntax.
 @end defopt
 
+@cindex \( in strings
 @defopt open-paren-in-column-0-is-defun-start
 If this variable's value is non-@code{nil}, an open parenthesis in
 column 0 is considered to be the start of a defun.  If it is
 @code{nil}, an open parenthesis in column 0 has no special meaning.
-The default is @code{t}.
+The default is @code{t}.  If a string literal happens to have a
+parenthesis in column 0, escape it with a backslash to avoid a false
+positive.  @xref{Left Margin Paren,, Left Margin Convention, emacs,
+The GNU Emacs Manual}.
 @end defopt
 
 @defvar beginning-of-defun-function
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 8f0023c..dcba47a 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -23505,11 +23505,11 @@ XEmacs.  Here are examples:
         (png . (:relief -2))))
 @end lisp
 
-@pxref{Image Descriptors, ,Image Descriptors, elisp, The Emacs Lisp
-Reference Manual} for the valid properties for various image types.
-Currently, @code{pbm} is used for X-Face images and @code{png} is used
-for Face images in Emacs.  Only the @code{:face} property is effective
-on the @code{xface} image type in XEmacs if it is built with the
+@xref{Image Descriptors,,, elisp, The Emacs Lisp Reference Manual},
+for the valid properties for various image types.  Currently,
+@code{pbm} is used for X-Face images and @code{png} is used for Face
+images in Emacs.  Only the @code{:face} property is effective on the
+@code{xface} image type in XEmacs if it is built with the
 @samp{libcompface} library.
 @end table
 
@@ -23780,21 +23780,25 @@ The following variables offer control over how things 
are displayed.
 @item gnus-gravatar-size
 @vindex gnus-gravatar-size
 The size in pixels of gravatars.  Gravatars are always square, so one
-number for the size is enough.
+number for the size is enough.  If @code{nil}, this defaults to the
+value of @code{gravatar-size}.
 
 @item gnus-gravatar-properties
 @vindex gnus-gravatar-properties
-List of image properties applied to Gravatar images.
+List of image properties applied to Gravatar images (@pxref{Image
+Descriptors,,, elisp, The Emacs Lisp Reference Manual}).
 
 @item gnus-gravatar-too-ugly
 @vindex gnus-gravatar-too-ugly
-Regexp that matches mail addresses or names of people of which avatars
-should not be displayed, or @code{nil}.  It default to the value of
-@code{gnus-article-x-face-too-ugly} (@pxref{X-Face}).
+Regexp that matches mail addresses or names of people whose avatars
+should not be displayed, or @code{nil} to display all avatars.  It
+defaults to the value of @code{gnus-article-x-face-too-ugly}
+(@pxref{X-Face}).
 
 @end table
 
-If you want to see them in the From field, set:
+If you want to see gravatars in the From field, set:
+
 @lisp
 (setq gnus-treat-from-gravatar 'head)
 @end lisp
diff --git a/etc/NEWS.25 b/etc/NEWS.25
index 98aec3c..d45f1dd 100644
--- a/etc/NEWS.25
+++ b/etc/NEWS.25
@@ -452,6 +452,11 @@ specified message types for the respective specified 
targets.
 *** Nick completion is now case-insensitive again after inadvertently
 being made case-sensitive in Emacs 24.2.
 
+** Rcirc
+
+*** Rcirc now supports automatic reconnection.
+Set new user option 'rcirc-reconnect-delay' to non-zero to enable it.
+
 ** MPC
 
 *** New commands, key binds, and menu items.
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
index a84c63d..e26b6b9 100644
--- a/lisp/emacs-lisp/package-x.el
+++ b/lisp/emacs-lisp/package-x.el
@@ -47,6 +47,8 @@
 
 (defcustom package-archive-upload-base "/path/to/archive"
   "The base location of the archive to which packages are uploaded.
+The commands in the package-x library will use this as base
+location.
 This should be an absolute directory name.  If the archive is on
 another machine, you may specify a remote name in the usual way,
 e.g. \"/ssh:address@hidden:/var/www/packages/\".
@@ -273,7 +275,9 @@ if it exists."
 (defun package-upload-buffer ()
   "Upload the current buffer as a single-file Emacs Lisp package.
 If `package-archive-upload-base' does not specify a valid upload
-destination, prompt for one."
+destination, prompt for one.
+Signal an error if the current buffer is not visiting a simple
+package (a \".el\" file)."
   (interactive)
   (save-excursion
     (save-restriction
@@ -287,8 +291,13 @@ destination, prompt for one."
 Interactively, prompt for FILE.  The package is considered a
 single-file package if FILE ends in \".el\", and a multi-file
 package if FILE ends in \".tar\".
+Automatically extract package attributes and update the archive's
+contents list with this information.
 If `package-archive-upload-base' does not specify a valid upload
-destination, prompt for one."
+destination, prompt for one.  If the directory does not exist, it
+is created.  The directory need not have any initial contents
+\(i.e., you can use this command to populate an initially empty
+archive)."
   (interactive "fPackage file name: ")
   (with-temp-buffer
     (insert-file-contents file)
diff --git a/lisp/gnus/gnus-gravatar.el b/lisp/gnus/gnus-gravatar.el
index d271a52..19cbf52 100644
--- a/lisp/gnus/gnus-gravatar.el
+++ b/lisp/gnus/gnus-gravatar.el
@@ -46,7 +46,8 @@ If nil, default to `gravatar-size'."
   :group 'gnus-gravatar)
 
 (defcustom gnus-gravatar-too-ugly gnus-article-x-face-too-ugly
-  "Regexp matching posters whose avatar shouldn't be shown automatically."
+  "Regexp matching posters whose avatar shouldn't be shown automatically.
+If nil, show all avatars."
   :type '(choice regexp (const nil))
   :version "24.1"
   :group 'gnus-gravatar)
diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index 91da840..9a1ec3b 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -40,18 +40,35 @@
 
 ;; FIXME a time value is not the nicest format for a custom variable.
 (defcustom gravatar-cache-ttl (days-to-time 30)
-  "Time to live for gravatar cache entries."
+  "Time to live for gravatar cache entries.
+If a requested gravatar has been cached for longer than this, it
+is retrieved anew."
   :type '(repeat integer)
   :group 'gravatar)
 
-;; FIXME Doc is tautological.  What are the options?
 (defcustom gravatar-rating "g"
-  "Default rating for gravatar."
+  "Most explicit Gravatar rating level to allow.
+Some gravatars are rated according to how suitable they are for
+different audiences.  The supported rating levels are, in order
+of increasing explicitness, the following:
+
+\"g\"  - Suitable for any audience.
+\"pg\" - May contain rude gestures, provocatively dressed
+       individuals, mild profanity, or mild violence.
+\"r\"  - May contain harsh profanity, intense violence, nudity,
+       or hard drug use.
+\"x\"  - May contain hardcore sexual imagery or extremely
+       disturbing violence.
+
+Each level covers itself as well as all less explicit levels.
+For example, setting this variable to \"pg\" will allow gravatars
+rated either \"g\" or \"pg\"."
   :type 'string
   :group 'gravatar)
 
 (defcustom gravatar-size 32
-  "Default size in pixels for gravatars."
+  "Gravatar size in pixels to request.
+Valid sizes range from 1 to 2048 inclusive."
   :type 'integer
   :group 'gravatar)
 
@@ -100,8 +117,10 @@ If no image available, return 'error."
 
 ;;;###autoload
 (defun gravatar-retrieve (mail-address cb &optional cbargs)
-  "Retrieve MAIL-ADDRESS gravatar and call CB on retrieval.
-You can provide a list of argument to pass to CB in CBARGS."
+  "Asynchronously retrieve a gravatar for MAIL-ADDRESS.
+When finished, call CB as (apply CB GRAVATAR CBARGS),
+where GRAVATAR is either an image descriptor, or the symbol
+`error' if the retrieval failed."
   (let ((url (gravatar-build-url mail-address)))
     (if (gravatar-cache-expired url)
        (let ((args (list url
@@ -120,7 +139,9 @@ You can provide a list of argument to pass to CB in CBARGS."
 
 ;;;###autoload
 (defun gravatar-retrieve-synchronously (mail-address)
-  "Retrieve MAIL-ADDRESS gravatar and returns it."
+  "Synchronously retrieve a gravatar for MAIL-ADDRESS.
+Value is either an image descriptor, or the symbol `error' if the
+retrieval failed."
   (let ((url (gravatar-build-url mail-address)))
     (if (gravatar-cache-expired url)
         (with-current-buffer (url-retrieve-synchronously url)
diff --git a/lisp/term.el b/lisp/term.el
index b5f4c62..77fbb1d 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -33,6 +33,21 @@
 
 ;;; Commentary:
 
+;; This file defines a general command-interpreter-in-a-buffer package
+;; (term mode).  The idea is that you can build specific process-in-a-buffer
+;; modes on top of term mode -- e.g., lisp, shell, scheme, T, soar, ....
+;; This way, all these specific packages share a common base functionality,
+;; and a common set of bindings, which makes them easier to use (and
+;; saves code, implementation time, etc., etc.).
+
+;; If, instead of `term', you call `ansi-term', you get multiple term
+;; buffers, after every new call ansi-term opens a new
+;; "*ansi-term*<xx>" window, where <xx> is, as usual, a number...
+
+;; For hints on converting existing process modes (e.g., tex-mode,
+;; background, dbx, gdb, kermit, prolog, telnet) to use term-mode
+;; instead of shell-mode, see the notes at the end of this file.
+
 ;; Speed considerations and a few caveats
 ;; --------------------------------------
 ;;
@@ -85,13 +100,6 @@
 ;; # By default nobody can't do anything
 ;; deny        root            *
 ;;
-;;
-;;             ----------------------------------------
-;;
-;;  If, instead of 'term', you call 'ansi-term', you get multiple term
-;; buffers, after every new call ansi-term opens a new *ansi-term*<xx> window,
-;; where <xx> is, as usual, a number...
-;;
 ;;             ----------------------------------------
 ;;
 ;;  With the term-buffer-maximum-size you can finally decide how many
@@ -111,38 +119,6 @@
 ;;  - Add hooks to allow raw-mode keys to be configurable
 ;;  - Which keys are better ? \eOA or \e[A ?
 ;;
-;;
-;;  Changes:
-;;
-;; V4.0 January 1997
-;;
-;;   - Huge reworking of the faces code: now we only have roughly 20-30
-;;     faces for everything so we're even faster than the old md-term.el !
-;;   - Finished removing all the J-Shell code.
-;;
-;;  V3.0 January 1997
-;;
-;;  - Now all the supportable ANSI commands work well.
-;;  - Reworked a little the code: much less jsh-inspired stuff
-;;
-;;  V2.3 November
-;;
-;;  - Now all the faces are accessed through an array: much cleaner code.
-;;
-;;  V2.2 November 4 1996
-;;
-;;  - Implemented ANSI output colorization ( a bit rough but enough for
-;;    color_ls )
-;;
-;;  - Implemented a maximum limit for the scroll buffer (stolen from
-;;    comint.el)
-;;
-;;  v2.1 October 28 1996, first public release
-;;
-;;  - Some new keybindings for term-char mode ( notably home/end/...)
-;;  - Directory, hostname and username tracking via ange-ftp
-;;  - Multi-term capability via the ansi-term call
-;;
 ;;  ----------------------------------------------------------------
 ;;  You should/could have something like this in your .emacs to take
 ;;  full advantage of this package
@@ -156,7 +132,6 @@
 ;;                  (auto-fill-mode -1)
 ;;                  (setq tab-width 8 ))))
 ;;
-;;
 ;;             ----------------------------------------
 ;;
 ;;  If you want to use color ls the best setup is to have a different file
@@ -167,7 +142,6 @@
 ;;
 ;;             ----------------------------------------
 ;;
-;;
 ;;  # Configuration file for the color ls utility
 ;;  # This file goes in the /etc directory, and must be world readable.
 ;;  # You can copy this file to .dir_colors in your $HOME directory to
@@ -224,17 +198,23 @@
 ;;  .xbm 01;35
 ;;  .xpm 01;35
 ;;
-;;
 ;;             ----------------------------------------
 ;;
-;;  Notice: for directory/host/user tracking you need to have something
-;; like this in your shell startup script (this is for a POSIXish shell
-;; like Bash but should be quite easy to port to other shells).
+;; There are actually two methods for directory tracking, one
+;; implemented in `term-command-hook' which sets the directory
+;; according to an escape sequence of the form "\032/<directory>\n".
+;; Some shells like bash will already send this escape sequence when
+;; they detect they are running in Emacs.  This can be configured or
+;; disabled on the Emacs side by setting `term-command-hook' to
+;; a different function.
 ;;
-;; For troubleshooting in Bash, you can check the definition of the
-;; custom functions with the "type" command.  e.g. "type cd".  If you
-;; do not see the expected definition from the config below, then the
-;; directory tracking will not work.
+;; The second method is in `term-handle-ansi-terminal-messages' which
+;; sets user, host, and directory according to escape sequences of the
+;; form "\033AnSiTc <directory>\n" (replace the "c" with "u" and "h"
+;; for user and host, respectively).  If the user and host don't
+;; match, it will set directory to a remote one, so it is important to
+;; set user and host correctly first.  See the example bash
+;; configuration below.
 ;;
 ;;             ----------------------------------------
 ;;
@@ -258,31 +238,24 @@
 ;;
 ;;             # The \033 stands for ESC.
 ;;             # There is a space between "AnSiT?" and $whatever.
+;;             printf '\033AnSiTh %s\n' "$HOSTNAME"
+;;             printf '\033AnSiTu %s\n' "$USER"
+;;             printf '\033AnSiTc %s\n' "$PWD"
 ;;
 ;;             cd()    { command cd    "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
 ;;             pushd() { command pushd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
 ;;             popd()  { command popd  "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
 ;;
-;;             printf '\033AnSiTc %s\n' "$PWD"
-;;             printf '\033AnSiTh %s\n' "$HOSTNAME"
-;;             printf '\033AnSiTu %s\n' "$USER"
-;;
 ;;             # Use custom dircolors in term buffers.
 ;;             # eval $(dircolors $HOME/.emacs_dircolors)
 ;;     esac
 ;;
 ;;     # ...
 ;;
-;;
-
-;;; Original Commentary:
-;; ---------------------
-
-;; The changelog is at the end of this file.
-
-;; Please send me bug reports, bug fixes, and extensions, so that I can
-;; merge them into the master source.
-;;     - Per Bothner (address@hidden)
+;; For troubleshooting in Bash, you can check the definition of the
+;; custom functions with the "type" command.  e.g. "type cd".  If you
+;; do not see the expected definition from the config below, then the
+;; directory tracking will not work.
 
 
 ;; Brief Command Documentation:
@@ -290,21 +263,21 @@
 ;; Term Mode Commands: (common to all derived modes, like cmushell & cmulisp
 ;; mode)
 ;;
-;; m-p     term-previous-input           Cycle backwards in input history
-;; m-n     term-next-input               Cycle forwards
-;; m-r     term-previous-matching-input  Previous input matching a regexp
-;; m-s     comint-next-matching-input      Next input that matches
+;; M-p     term-previous-input           Cycle backwards in input history
+;; M-n     term-next-input               Cycle forwards
+;; M-r     term-previous-matching-input  Previous input matching a regexp
+;; M-s     comint-next-matching-input    Next input that matches
 ;; return  term-send-input
-;; c-c c-a term-bol                      Beginning of line; skip prompt.
-;; c-d     term-delchar-or-maybe-eof     Delete char unless at end of buff.
-;; c-c c-u term-kill-input                 ^u
-;; c-c c-w backward-kill-word              ^w
-;; c-c c-c term-interrupt-subjob           ^c
-;; c-c c-z term-stop-subjob                ^z
-;; c-c c-\ term-quit-subjob                ^\
-;; c-c c-o term-kill-output                Delete last batch of process output
-;; c-c c-r term-show-output                Show last batch of process output
-;; c-c c-h term-dynamic-list-input-ring  List input history
+;; C-c C-a term-bol                      Beginning of line; skip prompt.
+;; C-d     term-delchar-or-maybe-eof     Delete char unless at end of buff.
+;; C-c C-u term-kill-input               ^u
+;; C-c C-w backward-kill-word            ^w
+;; C-c C-c term-interrupt-subjob         ^c
+;; C-c C-z term-stop-subjob              ^z
+;; C-c C-\ term-quit-subjob              ^\
+;; C-c C-o term-kill-output              Delete last batch of process output
+;; C-c C-r term-show-output              Show last batch of process output
+;; C-c C-h term-dynamic-list-input-ring  List input history
 ;;
 ;; Not bound by default in term-mode
 ;; term-send-invisible                 Read a line w/o echo, and send to proc
@@ -314,8 +287,8 @@
 ;; term-replace-by-expanded-filename   Expand and complete filename at point;
 ;;                                     replace with expanded/completed name.
 ;; term-kill-subjob                    No mercy.
-;; term-show-maximum-output            Show as much output as possible.
-;; term-continue-subjob                Send CONT signal to buffer's process
+;; term-show-maximum-output             Show as much output as possible.
+;; term-continue-subjob                 Send CONT signal to buffer's process
 ;;                                     group.  Useful if you accidentally
 ;;                                     suspend your process (with C-c C-z).
 
diff --git a/lisp/view.el b/lisp/view.el
index e4489b3..deda061 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -383,8 +383,8 @@ own View-like bindings."
   "Toggle View mode, a minor mode for viewing text but not editing it.
 
 When View mode is enabled, commands that do not change the buffer
-contents are available as usual.  Kill commands insert text in
-kill buffers but do not delete.  Most other commands beep and
+contents are available as usual.  Kill commands save text but
+do not delete it from the buffer.  Most other commands beep and
 tell the user that the buffer is read-only.
 
 \\<view-mode-map>
diff --git a/lisp/window.el b/lisp/window.el
index 8597f87..8b12c43 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8685,7 +8685,7 @@ and defaults to `window-min-width'.  Both MAX-WIDTH and 
MIN-WIDTH
 are specified in columns and include fringes, margins, a
 scrollbar and a vertical divider, if any.
 
-If the optional argument `preserve-size' is non-nil, preserve the
+Optional argument PRESERVE-SIZE non-nil means to preserve the
 size of WINDOW (see `window-preserve-size').
 
 Fit pixelwise if the option `window-resize-pixelwise' is non-nil.
diff --git a/src/process.c b/src/process.c
index abadabe..066edbc 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1279,10 +1279,19 @@ The string argument is normally a multibyte string, 
except:
   if (NILP (filter))
     filter = Qinternal_default_process_filter;
 
-  pset_filter (p, filter);
-
   if (p->infd >= 0)
-    set_process_filter_masks (p);
+    {
+      /* If filter WILL be t, stop reading output.  */
+      if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
+        delete_read_fd (p->infd);
+      else if (/* If filter WAS t, then resume reading output.  */
+               EQ (p->filter, Qt)
+               /* Network or serial process not stopped:  */
+               && !EQ (p->command, Qt))
+        add_process_read_fd (p->infd);
+    }
+
+  pset_filter (p, filter);
 
   if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p))
     pset_childp (p, Fplist_put (p->childp, QCfilter, filter));
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index b853f77..7745fcc 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -144,6 +144,35 @@
     (should (equal "hello stderr!\n"
                   (mapconcat #'identity (nreverse stderr-output) "")))))
 
+(ert-deftest set-process-filter-t ()
+  "Test setting process filter to t and back." ;; Bug#36591
+  (with-temp-buffer
+    (let* ((print-level nil)
+           (print-length nil)
+           (proc (start-process
+                  "test proc" (current-buffer)
+                  (concat invocation-directory invocation-name)
+                  "-Q" "--batch" "--eval"
+                  (prin1-to-string
+                   '(let (s)
+                      (while (setq s (read-from-minibuffer "$ "))
+                        (princ s)
+                        (princ "\n")))))))
+      (set-process-query-on-exit-flag proc nil)
+      (send-string proc "one\n")
+      (should
+       (accept-process-output proc 1))  ; Read "one".
+      (should (equal (buffer-string) "$ one\n$ "))
+      (set-process-filter proc t)       ; Stop reading from proc.
+      (send-string proc "two\n")
+      (should-not
+       (accept-process-output proc 1))  ; Can't read "two" yet.
+      (should (equal (buffer-string) "$ one\n$ "))
+      (set-process-filter proc nil)     ; Resume reading from proc.
+      (should
+       (accept-process-output proc 1))  ; Read "two" from proc.
+      (should (equal (buffer-string) "$ one\n$ two\n$ ")))))
+
 (ert-deftest start-process-should-not-modify-arguments ()
   "`start-process' must not modify its arguments in-place."
   ;; See bug#21831.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]