Questions tagged [sh-mode]

Major mode for editing shell scripts.

Filter by
Sorted by
Tagged with
2 votes
2 answers
74 views

Can emacs handle bash extglob case patterns properly?

This question is in two parts: How to cause emacs linter to recognize an extglob expression as an ability instead of a syntax error? How to cause emacs indenter to recognize an extglob expression as ...
Paul's user avatar
  • 183
0 votes
0 answers
69 views

How to make curly braces auto indent in sh-mode

If typed in sh-mode the closing brace is not auto-indented: function() { } If typed in c-mode the closing brace is auto-indented when inserted: function() { } The exact keystrokes are: f u n c t ...
mcp's user avatar
  • 546
0 votes
1 answer
127 views

How to set key binding to `C-c C-t` in `sh-mode`?

By default C-c C-t has sh-tmp-file binding in sh-mode, which I want to change.: C-c C-t runs the command sh-tmp-file (found in sh-mode-map), which is an interactive compiled Lisp function in ‘sh-...
alper's user avatar
  • 1,370
0 votes
2 answers
918 views

How do I change the default shell for `sh-mode`?

sh-mode usually does a great job of auto-magically detecting which shell a file is intended to be run by. It looks at the shebang, for instance. However, I have a bunch of files that are intended to ...
Harrison McCullough's user avatar
3 votes
1 answer
397 views

sh-mode: Scan error: "Containing expression ends prematurely",

Generate a file with this: (echo '#!/bin/bash' echo 'myfunc() {' echo "cat <<'z'" seq 135 echo zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz echo z echo '}') >out Open it in Emacs. When ...
Ole Tange's user avatar
  • 143
2 votes
1 answer
232 views

How to automatically select *interpretation* buffer window

When I am writing a shell script in sh-mode and decide to run it, I hit C-cC-x (executable-interpret). An *interpretation* buffer is displayed, showing the script's output. Is there a robust way to ...
John Goofy's user avatar
4 votes
0 answers
48 views

Highlight variables without $ inside (( )) when in sh-mode?

Is there a way to modify sh-mode to highlight variables inside a double parentheses construct when not using the dollar sign prefix? For example I want the i to be highlighted in ((i++)) without the ...
Carl Smedstad's user avatar
2 votes
1 answer
174 views

zsh expansion modifiers are treated as comments

zsh has a ton of syntax. In particular, the # character serves a bunch of different roles. Here are two that are problematic: Prefix globbing flags (#b)(*).c This finds all files that end in .c and ...
PythonNut's user avatar
  • 10.4k
1 vote
1 answer
206 views

How to make a file variable buffer local?

I have customized the variable sh-indentation with 4, but in one file I would like to use a different value. So I defined a file variable: # -*- mode: sh; sh-indentation: 2; -*- But the result is ...
ceving's user avatar
  • 1,358