Subject: [PATCH] Recognize PKGBUILD as bash style
From: Davide Masserut <[email-masked]>
To: [email-masked]
Date: Fri, 23 Jun 2023 15:46:03 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Arch Linux PKGBUILDs are Bash files [1], this patch adds detection 
to sh-mode.

[1]: 
https://wiki.archlinux.org/title/Creating_packages#Creating_a_PKGBUILD

In GNU Emacs 30.0.50 (build 9, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-06-21 built on T480s
Repository revision: 17e16f78596d895d6aca52d96b1caf9e82f7598b
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --sysconfdir=/etc --prefix=/usr --libexecdir=/usr/lib
 --localstatedir=/var --with-pgtk --with-native-compilation
 '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-mssdvd-git/src=/usr/src/debug/emacs-mssdvd-git'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
From ca838aaabbfefb042e0d7a324708b546022e3ccf Mon Sep 17 00:00:00 2001
From: Davide Masserut <[email-masked]>
Date: Tue, 20 Jun 2023 15:55:11 +0200
Subject: [PATCH] Recognize PKGBUILD as bash style

* lisp/progmodes/sh-script.el (sh--guess-shell): Handle PKGBUILD.
---
 lisp/progmodes/sh-script.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 6beff9f41e9..a305c35c5f8 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1489,6 +1489,7 @@ sh--guess-shell
         ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
         ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
 	((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
+	((equal (file-name-nondirectory buffer-file-name) "PKGBUILD") "bash")
         (t sh-shell-file)))
 
 ;;;###autoload
-- 
2.41.0