Subject: bug#54727: Recognize .bashrc as bash

From: Davide Masserut <[email-masked]>
Date: Tue, 05 Apr 2022 17:00:04 +0200

Tags: patch

I have just noticed that the .bashrc file is not recognized as a bash
file, so here is patch that should fix it.

In GNU Emacs 29.0.50 (build 45, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6)
 of 2022-04-05 built on T480s
Repository revision: 7d504c9acc0c8d75d11c3a2b5e016f39e6156bf8
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-modules --without-libotf --without-m17n-flt
 --without-gconf --without-gsettings --with-native-compilation
 --with-xinput2 --with-pgtk --without-xaw3d --with-sound=no
 --without-gpm --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=native -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -g
 -ffile-prefix-map=/home/davide/src/emacs-git/src=/usr/src/debug'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
 'CXXFLAGS=-march=native -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g
 -ffile-prefix-map=/home/davide/src/emacs-git/src=/usr/src/debug''

>From 5c7da5307751e1d8c4eb6e715f5073fc3f179018 Mon Sep 17 00:00:00 2001
From: Davide Masserut <[email-masked]>
Date: Tue, 5 Apr 2022 16:42:37 +0200
Subject: [PATCH] Add .bashrc detection to sh-mode

* lisp/progmodes/sh-script.el (sh-mode): Add .bashrc string-match
---
 lisp/progmodes/sh-script.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 8dc5562143..9151fd0a34 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1549,7 +1549,7 @@ sh-mode
          ;; Checks that use `buffer-file-name' follow.
          ((string-match "\\.m?spec\\'" buffer-file-name) "rpm")
          ((string-match "[.]sh\\>"     buffer-file-name) "sh")
-         ((string-match "[.]bash\\>"   buffer-file-name) "bash")
+         ((string-match "[.]bash\\(rc\\)?\\>"   buffer-file-name) "bash")
          ((string-match "[.]ksh\\>"    buffer-file-name) "ksh")
          ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
          ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
-- 
2.35.1