GNU bug report logs - #61602
29.0.60; comint-mode redirection

Previous Next

Package: emacs;

Reported by: Rah Guzar <rahguzar <at> zohomail.eu>

Date: Sat, 18 Feb 2023 11:44:02 UTC

Severity: normal

Found in version 29.0.60

To reply to this bug, email your comments to 61602 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Sat, 18 Feb 2023 11:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rah Guzar <rahguzar <at> zohomail.eu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 18 Feb 2023 11:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rah Guzar <rahguzar <at> zohomail.eu>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; comint-mode redirection
Date: Sat, 18 Feb 2023 12:26:19 +0100
Dear Emacs maintainers,
   I have been working on a major mode derived from comint-mode. The mode
   uses redirection to show documentation in a separate buffer. Sometimes,
   a prompt would appear in the output of the command producing the
   documentation and this would end the redirection prematurely. Searching
   among variables in comint-mode I found comint-redirect-finished-regexp
   and its docstring made me believe that I could set it to change the end
   of redirection. However setting it had a no effect and looking at the
   sources I found that this is because it is set by comint-redirect-setup
   and comint-redirect-send-command-to-process calls comint-redirect-setup
   so that it is always set to comint-prompt-regexp during redirection.

   This is confusing behavior because docstring of
   comint-redirect-finished-regexp gives no clue that setting it will have
   no effect. Similarly the docstring of comint-prompt-regexp states that
   its value is only used when comint-use-prompt-regexp is non-nil but
   that is not true for redirection.

   Overall I think it would be nice to have an optional argument to
   comint-redirect-send-command-to-process which allows a user to
   explicitly pass the regexp to use for ending redirection.

   Another issue I had was that I wanted to run some commands when
   redirection ended. There didn't seem to be any hooks that accomplished
   this but from source of comint-redirect-preoutput-filter I found that
   comint-redirect-hook is run when redirection finishes. However
   comint-redirect-hook is not defined as a variable and nothing seems to
   give any hint of its existence.

Thanks,
Rahguzar


In GNU Emacs 29.0.60 (build 1, x86_64-suse-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.17.6) of 2023-02-17 built on build79
System Description: openSUSE Tumbleweed

Configured using:
 'configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu
 --program-prefix= --disable-dependency-tracking --prefix=/usr
 --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
 --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
 --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-pgtk --with-native-compilation=aot
 --with-cairo --with-libotf --with-jpeg --with-tiff --with-gif
 --with-png --with-rsvg --with-xft --with-xml2 --with-dbus --with-sound
 --with-json --with-mailutils --with-gnutls --with-tree-sitter
 --enable-locallisppath=/usr/share/emacs/29.0.60/site-lisp:/usr/share/emacs/site-lisp
 'CFLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
 -fstack-clash-protection -Werror=return-type -flto=auto'
 LDFLAGS=-Wl,-O2'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: mu4e-headers

Minor modes in effect:
  delete-selection-mode: t
  projectile-mode: t
  recentf-mode: t
  save-place-mode: t
  global-so-long-mode: t
  which-key-mode: t
  savehist-mode: t
  better-jumper-mode: t
  better-jumper-local-mode: t
  global-company-mode: t
  company-mode: t
  vertico-mode: t
  all-the-icons-completion-mode: t
  marginalia-mode: t
  evil-goggles-mode: t
  evil-escape-mode: t
  evil-snipe-override-mode: t
  evil-snipe-mode: t
  gcmh-mode: t
  winner-mode: t
  smartparens-global-mode: t
  ws-butler-global-mode: t
  global-undo-fu-session-mode: t
  undo-fu-mode: t
  workroom-mode: t
  mu4e-search-minor-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  mu4e-update-minor-mode: t
  mu4e-context-minor-mode: t
  dirvish-override-dired-mode: t
  server-mode: t
  solaire-global-mode: t
  solaire-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  windmove-mode: t
  +popup-mode: t
  +modeline-global-mode: t
  +modeline-mode: t
  override-global-mode: t
  general-override-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  buffer-read-only: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/home/azeem/.emacs.d/.local/straight/build-29.0.60/citar-embark/citar-embark hides /home/azeem/.emacs.d/.local/straight/build-29.0.60/citar/citar-embark

Features:
(shadow disp-table whitespace delsel display-line-numbers adaptive-wrap
spell-fu ispell auto-minor-mode projectile lisp-mnt evil-collection-grep
grep ibuf-ext evil-collection-ibuffer ibuffer ibuffer-loaddefs recentf
tree-widget saveplace evil-collection-so-long so-long emacsbug sort
gnus-cite smiley shr-color mm-archive mail-extr textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check qp cursor-sensor
vertico-repeat evil-collection-which-key which-key savehist
better-jumper company-capf company evil-collection-vertico vertico
orderless all-the-icons-completion marginalia evil-goggles pulse color
evil-easymotion evil-escape evil-snipe autorevert filenotify gcmh winner
smartparens-config smartparens-text smartparens dash ws-butler
undo-fu-session undo-fu workroom compat desktop frameset
evil-collection-mu4e mu4e mu4e-org evil-collection-org smartparens-org
org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
ob-comint org-pcomplete org-list org-footnote org-faces org-entities
noutline outline ob-emacs-lisp org-table ol org-keys oc-natbib oc-csl
bibtex oc-biblatex oc org-loaddefs find-func mu4e-main mu4e-view
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum
gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail
mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range
gnus-win evil-collection-gnus gnus nnheader range
evil-collection-calendar cal-menu calendar cal-loaddefs mu4e-headers
mu4e-compose mu4e-draft mu4e-actions smtpmail mu4e-search mu4e-lists
mu4e-bookmarks mu4e-mark mu4e-message shr pixel-fill kinsoku url-file
svg xml dom browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util url-parse
auth-source json map url-vars flow-fill mule-util hl-line mu4e-contacts
mu4e-update mu4e-folders mu4e-server mu4e-context mu4e-vars mu4e-helpers
mu4e-config evil-collection-bookmark bookmark ido message sendmail
mailcap yank-media puny dirvish transient eieio eieio-core
evil-collection-dired dired dired-loaddefs rfc822 mml mml-sec
password-cache evil-collection-epa epa epg rfc6068 epg-config gnus-util
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader server dtrt-indent doom-themes-ext-org solaire-mode
face-remap doom-earl-grey-theme doom-themes doom-themes-base midnight
evil-collection-flymake flymake-proc flymake project
evil-collection-compile evil-collection-custom cus-edit cus-load
wid-edit evil-collection-comint evil-collection annalist compile
text-property-search html2text ob-core org-cycle org-fold org-fold-core
org-compat ob-eval org-version org-macs format-spec ibuf-macs evil
evil-integration evil-maps evil-commands reveal flyspell evil-jumps
evil-command-window evil-search shell pcomplete comint ansi-osc
ansi-color evil-types evil-macros evil-repeat evil-states evil-core comp
comp-cstr warnings icons byte-opt advice evil-common windmove calc
calc-loaddefs calc-macs thingatpt rect evil-digraphs evil-vars ring
all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons let-alist
derived edmacro kmacro use-package-bind-key bind-key rx doom-editor
doom-projects doom-ui easy-mmode doom-keybinds pp cl-extra help-mode
use-package-core bytecomp byte-compile general tex-site doom-start
doom-modules cl-seq doom doom-lib cl-macs cl-loaddefs cl-lib pcase gv
jansson dynamic-modules subr-x rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 944541 309286)
 (symbols 48 41240 1)
 (strings 32 291783 19116)
 (string-bytes 1 6577740)
 (vectors 16 85429)
 (vector-slots 8 2190100 207157)
 (floats 8 1276 1590)
 (intervals 56 12251 9085)
 (buffers 984 21))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Sun, 09 Apr 2023 10:11:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rah Guzar <rahguzar <at> zohomail.eu>
To: Rah Guzar <rahguzar <at> zohomail.eu>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 29.0.60; comint-mode redirection
Date: Sun, 09 Apr 2023 12:04:28 +0200
[Message part 1 (text/plain, inline)]
Dear Emacs maintainers,
  Please find attached a patch that addresses these points. If desired I
  can also separate out the documentation changes which I think are more
  important from the code changes. I think even code changes are trivial
  and safe. Please let me know if any changes are required.

  I have not yet signed the copyright assignment but I am in the process
  of doing it. I think this change falls within the 15 lines exemption
  although it saturates it.

Thanks,
Rah Guzar

Rah Guzar <rahguzar <at> zohomail.eu> writes:

> Dear Emacs maintainers,
>    I have been working on a major mode derived from comint-mode. The mode
>    uses redirection to show documentation in a separate buffer. Sometimes,
>    a prompt would appear in the output of the command producing the
>    documentation and this would end the redirection prematurely. Searching
>    among variables in comint-mode I found comint-redirect-finished-regexp
>    and its docstring made me believe that I could set it to change the end
>    of redirection. However setting it had a no effect and looking at the
>    sources I found that this is because it is set by comint-redirect-setup
>    and comint-redirect-send-command-to-process calls comint-redirect-setup
>    so that it is always set to comint-prompt-regexp during redirection.
>
>    This is confusing behavior because docstring of
>    comint-redirect-finished-regexp gives no clue that setting it will have
>    no effect. Similarly the docstring of comint-prompt-regexp states that
>    its value is only used when comint-use-prompt-regexp is non-nil but
>    that is not true for redirection.
>
>    Overall I think it would be nice to have an optional argument to
>    comint-redirect-send-command-to-process which allows a user to
>    explicitly pass the regexp to use for ending redirection.
>
>    Another issue I had was that I wanted to run some commands when
>    redirection ended. There didn't seem to be any hooks that accomplished
>    this but from source of comint-redirect-preoutput-filter I found that
>    comint-redirect-hook is run when redirection finishes. However
>    comint-redirect-hook is not defined as a variable and nothing seems to
>    give any hint of its existence.
>
> Thanks,
> Rahguzar
>
>
> In GNU Emacs 29.0.60 (build 1, x86_64-suse-linux-gnu, GTK+ Version
>  3.24.35, cairo version 1.17.6) of 2023-02-17 built on build79
> System Description: openSUSE Tumbleweed
>
> Configured using:
>  'configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu
>  --program-prefix= --disable-dependency-tracking --prefix=/usr
>  --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
>  --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
>  --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var
>  --sharedstatedir=/var/lib --mandir=/usr/share/man
>  --infodir=/usr/share/info --with-pgtk --with-native-compilation=aot
>  --with-cairo --with-libotf --with-jpeg --with-tiff --with-gif
>  --with-png --with-rsvg --with-xft --with-xml2 --with-dbus --with-sound
>  --with-json --with-mailutils --with-gnutls --with-tree-sitter
>  --enable-locallisppath=/usr/share/emacs/29.0.60/site-lisp:/usr/share/emacs/site-lisp
>  'CFLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
>  -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
>  -fstack-clash-protection -Werror=return-type -flto=auto'
>  LDFLAGS=-Wl,-O2'
>
> Configured features:
> CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
> LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
> PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB
>
> Important settings:
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: mu4e-headers
>
> Minor modes in effect:
>   delete-selection-mode: t
>   projectile-mode: t
>   recentf-mode: t
>   save-place-mode: t
>   global-so-long-mode: t
>   which-key-mode: t
>   savehist-mode: t
>   better-jumper-mode: t
>   better-jumper-local-mode: t
>   global-company-mode: t
>   company-mode: t
>   vertico-mode: t
>   all-the-icons-completion-mode: t
>   marginalia-mode: t
>   evil-goggles-mode: t
>   evil-escape-mode: t
>   evil-snipe-override-mode: t
>   evil-snipe-mode: t
>   gcmh-mode: t
>   winner-mode: t
>   smartparens-global-mode: t
>   ws-butler-global-mode: t
>   global-undo-fu-session-mode: t
>   undo-fu-mode: t
>   workroom-mode: t
>   mu4e-search-minor-mode: t
>   global-hl-line-mode: t
>   hl-line-mode: t
>   mu4e-update-minor-mode: t
>   mu4e-context-minor-mode: t
>   dirvish-override-dired-mode: t
>   server-mode: t
>   solaire-global-mode: t
>   solaire-mode: t
>   shell-dirtrack-mode: t
>   evil-mode: t
>   evil-local-mode: t
>   windmove-mode: t
>   +popup-mode: t
>   +modeline-global-mode: t
>   +modeline-mode: t
>   override-global-mode: t
>   general-override-mode: t
>   global-eldoc-mode: t
>   eldoc-mode: t
>   show-paren-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   window-divider-mode: t
>   buffer-read-only: t
>   size-indication-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   abbrev-mode: t
>
> Load-path shadows:
> /home/azeem/.emacs.d/.local/straight/build-29.0.60/citar-embark/citar-embark hides /home/azeem/.emacs.d/.local/straight/build-29.0.60/citar/citar-embark
>
> Features:
> (shadow disp-table whitespace delsel display-line-numbers adaptive-wrap
> spell-fu ispell auto-minor-mode projectile lisp-mnt evil-collection-grep
> grep ibuf-ext evil-collection-ibuffer ibuffer ibuffer-loaddefs recentf
> tree-widget saveplace evil-collection-so-long so-long emacsbug sort
> gnus-cite smiley shr-color mm-archive mail-extr textsec uni-scripts
> idna-mapping ucs-normalize uni-confusable textsec-check qp cursor-sensor
> vertico-repeat evil-collection-which-key which-key savehist
> better-jumper company-capf company evil-collection-vertico vertico
> orderless all-the-icons-completion marginalia evil-goggles pulse color
> evil-easymotion evil-escape evil-snipe autorevert filenotify gcmh winner
> smartparens-config smartparens-text smartparens dash ws-butler
> undo-fu-session undo-fu workroom compat desktop frameset
> evil-collection-mu4e mu4e mu4e-org evil-collection-org smartparens-org
> org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src
> ob-comint org-pcomplete org-list org-footnote org-faces org-entities
> noutline outline ob-emacs-lisp org-table ol org-keys oc-natbib oc-csl
> bibtex oc-biblatex oc org-loaddefs find-func mu4e-main mu4e-view
> gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum
> gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail
> mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range
> gnus-win evil-collection-gnus gnus nnheader range
> evil-collection-calendar cal-menu calendar cal-loaddefs mu4e-headers
> mu4e-compose mu4e-draft mu4e-actions smtpmail mu4e-search mu4e-lists
> mu4e-bookmarks mu4e-mark mu4e-message shr pixel-fill kinsoku url-file
> svg xml dom browse-url url url-proxy url-privacy url-expand url-methods
> url-history url-cookie generate-lisp-file url-domsuf url-util url-parse
> auth-source json map url-vars flow-fill mule-util hl-line mu4e-contacts
> mu4e-update mu4e-folders mu4e-server mu4e-context mu4e-vars mu4e-helpers
> mu4e-config evil-collection-bookmark bookmark ido message sendmail
> mailcap yank-media puny dirvish transient eieio eieio-core
> evil-collection-dired dired dired-loaddefs rfc822 mml mml-sec
> password-cache evil-collection-epa epa epg rfc6068 epg-config gnus-util
> time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
> rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
> mailheader server dtrt-indent doom-themes-ext-org solaire-mode
> face-remap doom-earl-grey-theme doom-themes doom-themes-base midnight
> evil-collection-flymake flymake-proc flymake project
> evil-collection-compile evil-collection-custom cus-edit cus-load
> wid-edit evil-collection-comint evil-collection annalist compile
> text-property-search html2text ob-core org-cycle org-fold org-fold-core
> org-compat ob-eval org-version org-macs format-spec ibuf-macs evil
> evil-integration evil-maps evil-commands reveal flyspell evil-jumps
> evil-command-window evil-search shell pcomplete comint ansi-osc
> ansi-color evil-types evil-macros evil-repeat evil-states evil-core comp
> comp-cstr warnings icons byte-opt advice evil-common windmove calc
> calc-loaddefs calc-macs thingatpt rect evil-digraphs evil-vars ring
> all-the-icons all-the-icons-faces data-material data-weathericons
> data-octicons data-fileicons data-faicons data-alltheicons let-alist
> derived edmacro kmacro use-package-bind-key bind-key rx doom-editor
> doom-projects doom-ui easy-mmode doom-keybinds pp cl-extra help-mode
> use-package-core bytecomp byte-compile general tex-site doom-start
> doom-modules cl-seq doom doom-lib cl-macs cl-loaddefs cl-lib pcase gv
> jansson dynamic-modules subr-x rmc iso-transl tooltip cconv eldoc paren
> electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
> term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
> image regexp-opt fringe tabulated-list replace newcomment text-mode
> lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
> easymenu timer select scroll-bar mouse jit-lock font-lock syntax
> font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
> indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
> tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
> romanian slovak czech european ethiopic indian cyrillic chinese
> composite emoji-zwj charscript charprop case-table epa-hook
> jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
> theme-loaddefs faces cus-face macroexp files window text-properties
> overlay sha1 md5 base64 format env code-pages mule custom widget keymap
> hashtable-print-readable backquote threads dbusbind inotify
> dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
> multi-tty make-network-process native-compile emacs)
>
> Memory information:
> ((conses 16 944541 309286)
>  (symbols 48 41240 1)
>  (strings 32 291783 19116)
>  (string-bytes 1 6577740)
>  (vectors 16 85429)
>  (vector-slots 8 2190100 207157)
>  (floats 8 1276 1590)
>  (intervals 56 12251 9085)
>  (buffers 984 21))

[comint-redirect.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Thu, 11 May 2023 17:52:02 GMT) Full text and rfc822 format available.

Message #11 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Rah Guzar <rahguzar <at> zohomail.eu>
To: 61602 <at> debbugs.gnu.org
Subject: [PATCH]: comint-mode redirection
Date: Thu, 11 May 2023 19:45:09 +0200
[Message part 1 (text/plain, inline)]
Dear Emacs Maintainers,
   A while back I sent a patch that addresses the points in this bug report. I have since received the confirmation that I have completed the copyright paperwork, so I am bringing it to your attention again. This is my first time contributing so please let me know if I should do somethings differently or if changes are needed.

Thanks,
Rah Guzar

[comint-redirect.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Thu, 11 May 2023 18:14:01 GMT) Full text and rfc822 format available.

Message #14 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Rah Guzar <rahguzar <at> zohomail.eu>
Cc: 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Thu, 11 May 2023 21:14:25 +0300
> Date: Thu, 11 May 2023 19:45:09 +0200
> From:  Rah Guzar via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Dear Emacs Maintainers,
>    A while back I sent a patch that addresses the points in this bug report. I have since received the confirmation that I have completed the copyright paperwork, so I am bringing it to your attention again. This is my first time contributing so please let me know if I should do somethings differently or if changes are needed.

Thanks, but your paperwork is not yet complete.  So please wait a bit
longer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Thu, 11 May 2023 18:40:02 GMT) Full text and rfc822 format available.

Message #17 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Rah Guzar <rahguzar <at> zohomail.eu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Thu, 11 May 2023 20:35:46 +0200
Hi Eli,
  On May 4th, I received an email from Craigh Topham including text,

> Hello,

> Your assignment/disclaimer process with the FSF is currently
> complete; your fully executed PDF will be sent to you in a separate
> email immediately following this one.

> Please remember to let us know when your employment status changes, as
> this may affect your assignment status.

> Thank you for your contribution!

and I also received the email with the pdf.

So I assumed the paperwork was complete.

Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Thu, 11 May 2023 19:45:09 +0200
>> From:  Rah Guzar via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> Dear Emacs Maintainers,
>>    A while back I sent a patch that addresses the points in this bug report. I have since received the confirmation that I have completed the copyright paperwork, so I am bringing it to your attention again. This is my first time contributing so please let me know if I should do somethings differently or if changes are needed.
>
> Thanks, but your paperwork is not yet complete.  So please wait a bit
> longer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 02:18:01 GMT) Full text and rfc822 format available.

Message #20 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Ruijie Yu <ruijie <at> netyu.xyz>
To: Rah Guzar <rahguzar <at> zohomail.eu>
Cc: 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Fri, 12 May 2023 10:16:48 +0800
Thanks for the patch.  First of all, when sending a patch(set) for
Emacs, you need to run something like this:

    $ git format-patch

and send the generated file(s).  Take a look at its manpage and ask if
you have any questions.  What you have sent is a "diff" file, which
bears no commit messages.  At least in Emacs contributions, patches
should usually come together with their commit messages.

And there are guidelines on commit messages, see /CONTRIBUTE on
emacs.git.

Further in-line comments below.

Rah Guzar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Dear Emacs Maintainers,
>    A while back I sent a patch that addresses the points in this bug report. I
> have since received the confirmation that I have completed the copyright
> paperwork, so I am bringing it to your attention again. This is my first time
> contributing so please let me know if I should do somethings differently or if
> changes are needed.
>
> Thanks,
> Rah Guzar
>
> [2. text/x-patch; comint-redirect.patch]...

> diff --git a/lisp/comint.el b/lisp/comint.el
> index 682b555a33c..98f4d315d64 100644
> --- a/lisp/comint.el
> +++ b/lisp/comint.el
> @@ -161,7 +161,10 @@ comint-prompt-regexp
>  Defaults to \"^\", the null string at BOL.
>  
>  This variable is only used if the variable
> -`comint-use-prompt-regexp' is non-nil.
> +`comint-use-prompt-regexp' is non-nil.  The exception to
> +this is redirection.  Many commands including
> +`comint-redirect-send-command-to-process' use it as
> +`comint-redirect-finished-regexp'.

This paragraph sounds a bit weird, but I don't know how to reword it.
Maybe someone else can help.

>  Good choices:
>    Canonical Lisp: \"^[^> \\n]*>+:? *\" (Lucid, franz, kcl, T, cscheme, oaklisp)
> @@ -3637,7 +3640,12 @@ comint-redirect-output-buffer
>  (defvar comint-redirect-finished-regexp nil
>    "Regular expression that determines when to stop redirection in Comint.
>  When the redirection filter function is given output that matches this regexp,
> -the output is inserted as usual, and redirection is completed.")
> +the output is inserted as usual, and redirection is completed.
> +This is an internal variable set by `comint-redirect-setup' and setting it
> +directly has no effect.")

If this is indeed a private variable, why does it contain no
double-dashes in its name prior to your changes?

Also, here and elsewhere, except for the first line, there should
generally be one empty line between paragraphs.

> +
> +(defvar comint-redirect-hook nil
> +  "Hook run when a redirection finishes.")

Does it make sense for a user to customize the hook?  If so, you should
convert this variable into a `defcustom'.

>  (defvar comint-redirect-insert-matching-regexp nil
>    "If non-nil, the text that ends a redirection is included in it.
> @@ -3833,11 +3841,13 @@ comint-redirect-send-command
>  
>  ;;;###autoload
>  (defun comint-redirect-send-command-to-process
> -  (command output-buffer process echo &optional no-display)
> +  (command output-buffer process echo &optional no-display finished-regexp)
>    "Send COMMAND to PROCESS, with output to OUTPUT-BUFFER.
>  With prefix arg, echo output in process buffer.
>  
> -If NO-DISPLAY is non-nil, do not show the output buffer."
> +If NO-DISPLAY is non-nil, do not show the output buffer.
> +If FINISHED-REGEXP is non-nil it is used as `comint-redirect-finished-regexp'
> +instead of `comint-prompt-regexp'."

Please clarify what "it" is.

If you are referring to the change below from `cominit-prompt-regexp' to
`(or finished-regexp comint-prompt-regexp)', then the current form is
ambiguous, and maybe you should say something like this:

    If F-R is non-nil, it is used as `c-r-f-r'.  Otherwise `c-p-r' is
    used as `c-r-f-r'.

>    (interactive "sCommand: \nBOutput Buffer: \nbProcess Buffer: \nP")
>    (let* (;; The process buffer
>  	 (process-buffer (if (processp process)
> @@ -3858,7 +3868,7 @@ comint-redirect-send-command-to-process
>        (comint-redirect-setup
>         output-buffer
>         (current-buffer)                 ; Comint Buffer
> -       comint-prompt-regexp             ; Finished Regexp
> +       (or finished-regexp comint-prompt-regexp)             ; Finished Regexp
>         echo)                            ; Echo input
>  
>        ;; Set the filter.

-- 
Best,


RY




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 05:28:01 GMT) Full text and rfc822 format available.

Message #23 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Rah Guzar <rahguzar <at> zohomail.eu>
Cc: 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Fri, 12 May 2023 08:28:06 +0300
> From: Rah Guzar <rahguzar <at> zohomail.eu>
> Cc: 61602 <at> debbugs.gnu.org
> Date: Thu, 11 May 2023 20:35:46 +0200
> 
> Hi Eli,
>   On May 4th, I received an email from Craigh Topham including text,
> 
> > Hello,
> 
> > Your assignment/disclaimer process with the FSF is currently
> > complete; your fully executed PDF will be sent to you in a separate
> > email immediately following this one.
> 
> > Please remember to let us know when your employment status changes, as
> > this may affect your assignment status.
> 
> > Thank you for your contribution!
> 
> and I also received the email with the pdf.
> 
> So I assumed the paperwork was complete.

I usually wait until the assignment is "officially" on file.  It is
there as of this morning, so we can accept your contributions.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 06:42:01 GMT) Full text and rfc822 format available.

Message #26 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ruijie Yu <ruijie <at> netyu.xyz>
Cc: rahguzar <at> zohomail.eu, 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Fri, 12 May 2023 09:42:52 +0300
> Cc: 61602 <at> debbugs.gnu.org
> Date: Fri, 12 May 2023 10:16:48 +0800
> From:  Ruijie Yu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> Thanks for the patch.  First of all, when sending a patch(set) for
> Emacs, you need to run something like this:
> 
>     $ git format-patch
> 
> and send the generated file(s).

No, this is not a requirement around here.  We prefer format-patch,
indeed, but we don't enforce it.  Simple diffs are perfectly
acceptable.

> What you have sent is a "diff" file, which bears no commit messages.
> At least in Emacs contributions, patches should usually come
> together with their commit messages.

That is true.  But adding commit log messages doesn't have to be via
"git format-patch".

> > --- a/lisp/comint.el
> > +++ b/lisp/comint.el
> > @@ -161,7 +161,10 @@ comint-prompt-regexp
> >  Defaults to \"^\", the null string at BOL.
> >  
> >  This variable is only used if the variable
> > -`comint-use-prompt-regexp' is non-nil.
> > +`comint-use-prompt-regexp' is non-nil.  The exception to
> > +this is redirection.  Many commands including
> > +`comint-redirect-send-command-to-process' use it as
> > +`comint-redirect-finished-regexp'.
> 
> This paragraph sounds a bit weird, but I don't know how to reword it.
> Maybe someone else can help.

I'm not sure the addition is necessary in the first place.  What is
its purpose? why is it useful to mention those exceptional cases?

> Also, here and elsewhere, except for the first line, there should
> generally be one empty line between paragraphs.

This is not a requirement.  It's a judgment call whether an empty line
is needed or not.

> > -If NO-DISPLAY is non-nil, do not show the output buffer."
> > +If NO-DISPLAY is non-nil, do not show the output buffer.
> > +If FINISHED-REGEXP is non-nil it is used as `comint-redirect-finished-regexp'
> > +instead of `comint-prompt-regexp'."
> 
> Please clarify what "it" is.

I think it's clear in this case: there's no other candidate for being
"it" here except FINISHED-REGEXP.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 07:00:02 GMT) Full text and rfc822 format available.

Message #29 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Ruijie Yu <ruijie <at> netyu.xyz>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rahguzar <at> zohomail.eu, 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Fri, 12 May 2023 14:58:55 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 61602 <at> debbugs.gnu.org
>> Date: Fri, 12 May 2023 10:16:48 +0800
>> From:  Ruijie Yu via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> 
>> Thanks for the patch.  First of all, when sending a patch(set) for
>> Emacs, you need to run something like this:
>> 
>>     $ git format-patch
>> 
>> and send the generated file(s).
>
> No, this is not a requirement around here.  We prefer format-patch,
> indeed, but we don't enforce it.  Simple diffs are perfectly
> acceptable.

Yes, I should have worded that way.  I meant exactly what you said: it
is a preferred way but not a requirement.

>> What you have sent is a "diff" file, which bears no commit messages.
>> At least in Emacs contributions, patches should usually come
>> together with their commit messages.
>
> That is true.  But adding commit log messages doesn't have to be via
> "git format-patch".

Yes.

>> > --- a/lisp/comint.el
>> > +++ b/lisp/comint.el
>> > @@ -161,7 +161,10 @@ comint-prompt-regexp
>> >  Defaults to \"^\", the null string at BOL.
>> >  
>> >  This variable is only used if the variable
>> > -`comint-use-prompt-regexp' is non-nil.
>> > +`comint-use-prompt-regexp' is non-nil.  The exception to
>> > +this is redirection.  Many commands including
>> > +`comint-redirect-send-command-to-process' use it as
>> > +`comint-redirect-finished-regexp'.
>> 
>> This paragraph sounds a bit weird, but I don't know how to reword it.
>> Maybe someone else can help.
>
> I'm not sure the addition is necessary in the first place.  What is
> its purpose? why is it useful to mention those exceptional cases?
>
>> Also, here and elsewhere, except for the first line, there should
>> generally be one empty line between paragraphs.
>
> This is not a requirement.  It's a judgment call whether an empty line
> is needed or not.

Noted.

>> > -If NO-DISPLAY is non-nil, do not show the output buffer."
>> > +If NO-DISPLAY is non-nil, do not show the output buffer.
>> > +If FINISHED-REGEXP is non-nil it is used as `comint-redirect-finished-regexp'
>> > +instead of `comint-prompt-regexp'."
>> 
>> Please clarify what "it" is.
>
> I think it's clear in this case: there's no other candidate for being
> "it" here except FINISHED-REGEXP.

When I first read this sentence, I interpretted it as:

    If F-R is non-nil, F-R is used as `c-r-f-r'.  Otherwise F-R is used
    as `c-p-r'.

I don't know.  Maybe you see it differently, in which case I'm fine with
not changing it.

-- 
Best,


RY




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 07:25:02 GMT) Full text and rfc822 format available.

Message #32 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Rah Guzar <rahguzar <at> zohomail.eu>
To: Ruijie Yu <ruijie <at> netyu.xyz>
Cc: 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Fri, 12 May 2023 09:11:05 +0200
[Message part 1 (text/plain, inline)]
Hi Ruijie,
   Thanks for the comments.

Ruijie Yu <ruijie <at> netyu.xyz> writes:

> Thanks for the patch.  First of all, when sending a patch(set) for
> Emacs, you need to run something like this:
>
>     $ git format-patch
>
> and send the generated file(s).  Take a look at its manpage and ask if
> you have any questions.  What you have sent is a "diff" file, which
> bears no commit messages.  At least in Emacs contributions, patches
> should usually come together with their commit messages.
>
> And there are guidelines on commit messages, see /CONTRIBUTE on
> emacs.git.

I have attached a patch which hopefully is made properly this time.

> Further in-line comments below.
>
> Rah Guzar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>>  This variable is only used if the variable
>> -`comint-use-prompt-regexp' is non-nil.
>> +`comint-use-prompt-regexp' is non-nil.  The exception to
>> +this is redirection.  Many commands including
>> +`comint-redirect-send-command-to-process' use it as
>> +`comint-redirect-finished-regexp'.
>
> This paragraph sounds a bit weird, but I don't know how to reword it.
> Maybe someone else can help.
>

I tried some rewording.

>>  (defvar comint-redirect-finished-regexp nil
>>    "Regular expression that determines when to stop redirection in Comint.
>>  When the redirection filter function is given output that matches this regexp,
>> -the output is inserted as usual, and redirection is completed.")
>> +the output is inserted as usual, and redirection is completed.
>> +This is an internal variable set by `comint-redirect-setup' and setting it
>> +directly has no effect.")
>
> If this is indeed a private variable, why does it contain no
> double-dashes in its name prior to your changes?
>
> Also, here and elsewhere, except for the first line, there should
> generally be one empty line between paragraphs.
>

It is not declared as a private variable but it is in effect used as
one, so documenting should prevent confusion. Some context: I wanted
to use redirection to display some documentation is a separate buffer.
However documentation sometimes contained the usual prompt and that
messed up the comint buffer. To get around it I setup the redirected
commands so that they had a custom prompt and tried to set c-r-f-r
accordingly but that didn't work and I had to fish around the comint
source to figure out why.

>> +(defvar comint-redirect-hook nil
>> +  "Hook run when a redirection finishes.")

> Does it make sense for a user to customize the hook?  If so, you should
> convert this variable into a `defcustom'.

This for better discoverability. I think comint-mode is too low-level for
most users to use it directly. But e.g. for those writing a derived mode
it is good to be aware that this hook exists without diving into source.

>> +If FINISHED-REGEXP is non-nil it is used as `comint-redirect-finished-regexp'
>> +instead of `comint-prompt-regexp'."
>
> Please clarify what "it" is.
>
> If you are referring to the change below from `cominit-prompt-regexp' to
> `(or finished-regexp comint-prompt-regexp)', then the current form is
> ambiguous, and maybe you should say something like this:
>
>     If F-R is non-nil, it is used as `c-r-f-r'.  Otherwise `c-p-r' is
>     used as `c-r-f-r'.
>

Thanks, I incorporated your suggestion.

[0001-Bug-61602-Tweak-comint-mode-redirection.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 07:30:01 GMT) Full text and rfc822 format available.

Message #35 received at 61602 <at> debbugs.gnu.org (full text, mbox):

From: Rah Guzar <rahguzar <at> zohomail.eu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ruijie Yu <ruijie <at> netyu.xyz>, 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Fri, 12 May 2023 09:25:45 +0200
Hi Eli,

Eli Zaretskii <eliz <at> gnu.org> writes:

>> >  This variable is only used if the variable
>> > -`comint-use-prompt-regexp' is non-nil.
>> > +`comint-use-prompt-regexp' is non-nil.  The exception to
>> > +this is redirection.  Many commands including
>> > +`comint-redirect-send-command-to-process' use it as
>> > +`comint-redirect-finished-regexp'.
>>
>> This paragraph sounds a bit weird, but I don't know how to reword it.
>> Maybe someone else can help.
>
> I'm not sure the addition is necessary in the first place.  What is
> its purpose? why is it useful to mention those exceptional cases?

I think it is useful for those writing a comint derived mode who might
be tempted to not set 'comint-prompt-regexp' since it is going to be
unused by default. Redirection is an important enough facility in
my opinion for this to be pointed out.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 07:55:01 GMT) Full text and rfc822 format available.

Message #38 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Ruijie Yu <ruijie <at> netyu.xyz>, rahguzar <at> zohomail.eu,
 Eli Zaretskii <eliz <at> gnu.org>, 61602 <at> debbugs.gnu.org
Subject: Re: bug#61602: [PATCH]: comint-mode redirection
Date: Fri, 12 May 2023 09:54:46 +0200
On Mai 12 2023, Ruijie Yu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

>>> > -If NO-DISPLAY is non-nil, do not show the output buffer."
>>> > +If NO-DISPLAY is non-nil, do not show the output buffer.
>>> > +If FINISHED-REGEXP is non-nil it is used as `comint-redirect-finished-regexp'
>>> > +instead of `comint-prompt-regexp'."
>>> 
>>> Please clarify what "it" is.
>>
>> I think it's clear in this case: there's no other candidate for being
>> "it" here except FINISHED-REGEXP.
>
> When I first read this sentence, I interpretted it as:
>
>     If F-R is non-nil, F-R is used as `c-r-f-r'.  Otherwise F-R is used
>     as `c-p-r'.
>
> I don't know.  Maybe you see it differently, in which case I'm fine with
> not changing it.

Perhaps a better wording:

FINISHED-REGEXP is used as `comint-redirect-finished-regexp'.  If
FINISHED-REGEXP is nil it defaults to `comint-prompt-regexp'.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61602; Package emacs. (Fri, 12 May 2023 07:55:02 GMT) Full text and rfc822 format available.

This bug report was last modified 349 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.