GNU bug report logs - #19812
24.4; suggest `shell-mode' not interactive

Previous Next

Package: emacs;

Reported by: Kevin Ryde <user42_kevin <at> yahoo.com.au>

Date: Sun, 8 Feb 2015 04:14:02 UTC

Severity: wishlist

Tags: fixed, patch

Found in version 24.4

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> mouse.gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> mouse.gnus.org>
Cc: user42_kevin <at> yahoo.com.au, Eli Zaretskii <eliz <at> gnu.org>,
 19812 <at> debbugs.gnu.org
Subject: Re: bug#19812: 24.4; suggest `shell-mode' not interactive
Date: Wed, 28 Aug 2019 01:13:25 +0300
> If I read the comments correctly, nobody had a use case for using `M-x
> shell-mode'.  It was proposed that it could possibly be useful for
> working in log files and the like, but that shell-mode doesn't currently
> actually support that, so I went ahead and applied the patch to disable
> the interactive use of the mode.

I confirm that `M-x shell-mode' can't be used in saved log files.  I tried:

  (defvar shell-log-font-lock-keywords
    ;; `shell-prompt-pattern' can't be used: it finds too many false matches
    '(("^\\([^#$%>\12]*@[^#$%>\12]*:[^#$%>\12]*[#$%>] *\\)\\(.*\\)$"
       (1 'comint-highlight-prompt)
       (2 'comint-highlight-input)))
    "Shell prompts to highlight in Shell Log mode.")

  (define-derived-mode shell-log-mode shell-mode "Shell-Log"
    "Font-lock for shell logs."
    (put 'shell-log-mode 'mode-class nil)
    (setq-local font-lock-defaults '(shell-log-font-lock-keywords t)))

  (add-to-list 'auto-mode-alist '("\\.log\\'" . shell-log-mode))

but `shell-prompt-pattern' matches too many false positives, and
replacing it with a customized regexp is too ad-hoc and unreliable.




This bug report was last modified 5 years and 273 days ago.

Previous Next


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