unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73380: [PATCH] Enable sh-mode when used by Bash fc
@ 2024-09-20 12:27 shynur .
  2024-09-28  9:32 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: shynur . @ 2024-09-20 12:27 UTC (permalink / raw)
  To: 73380

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

See the added comment in the patch.

The parent directory of "bash-fc.XXXXXX" cannot be determined.  It
varies from different environments.

Perhaps Bash will fix this bug in the future (i.e., add a meaningful
suffix e.g. ".bash" to "bash-fc.XXXXXX") so that no special handling
is necessary.  I don't know...

[-- Attachment #2: 0001-Enable-sh-mode-when-used-by-Bash-fc.patch --]
[-- Type: application/octet-stream, Size: 1046 bytes --]

From 6a85d461c1152c81c352600f712e1c9b169bcdb4 Mon Sep 17 00:00:00 2001
From: shynur <one.last.kiss@outlook.com>
Date: Fri, 20 Sep 2024 12:15:06 +0000
Subject: [PATCH] Enable sh-mode when used by Bash fc

---
 lisp/files.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/files.el b/lisp/files.el
index 6cbb1b5..c8ad250 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2990,6 +2990,9 @@ since only a single case-insensitive search through the alist is made."
      ("\\.scm\\.[0-9]*\\'" . scheme-mode)
      ("\\.[ckz]?sh\\'\\|\\.shar\\'\\|/\\.z?profile\\'" . sh-mode)
      ("\\.bash\\'" . sh-mode)
+     ;; Bash builtin 'fc' creates a temp file named "bash-fc.XXXXXX"
+     ;; to edit shell commands from its history list.
+     ("/bash-fc\\.[0-9A-Za-z]\\{6\\}\\'" . sh-mode)
      ("/PKGBUILD\\'" . sh-mode)
      ("\\(/\\|\\`\\)\\.\\(bash_\\(profile\\|history\\|log\\(in\\|out\\)\\)\\|z?log\\(in\\|out\\)\\)\\'" . sh-mode)
      ("\\(/\\|\\`\\)\\.\\(shrc\\|zshrc\\|m?kshrc\\|bashrc\\|t?cshrc\\|esrc\\)\\'" . sh-mode)
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-28  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 12:27 bug#73380: [PATCH] Enable sh-mode when used by Bash fc shynur .
2024-09-28  9:32 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).