unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Shell scripting mode
@ 2013-10-09  9:16 Adrián Martínez Larumbe
  2013-10-09 14:18 ` Tassilo Horn
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Adrián Martínez Larumbe @ 2013-10-09  9:16 UTC (permalink / raw)
  To: help-gnu-emacs

Hello everyone, this is my very first post on this list.
Since I use emacs for all of my code editing tasks, I wanted to turn it
into my environment of choice for developing bash shell
scripts. However, the major mode that ships with emacs seems fairly
feature-limited, and I was wondering if anybody knows any replacements
that would somehow mimic what vim users enjoy with this extension:

http://vim.sourceforge.net/scripts/script.php?script_id=365



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

* Re: Shell scripting mode
  2013-10-09  9:16 Shell scripting mode Adrián Martínez Larumbe
@ 2013-10-09 14:18 ` Tassilo Horn
  2013-10-09 14:34 ` Doug Lewan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Tassilo Horn @ 2013-10-09 14:18 UTC (permalink / raw)
  To: Adrián Martínez Larumbe; +Cc: help-gnu-emacs

adrianml@alumnos.upm.es (Adrián Martínez Larumbe) writes:

> Since I use emacs for all of my code editing tasks, I wanted to turn
> it into my environment of choice for developing bash shell
> scripts. However, the major mode that ships with emacs seems fairly
> feature-limited, and I was wondering if anybody knows any replacements
> that would somehow mimic what vim users enjoy with this extension:
>
> http://vim.sourceforge.net/scripts/script.php?script_id=365

I have never used that vim extension, but looking at the screenshots it
seems to be mostly about templates for different kinds of comments,
headers, and control structures.  You can have that (without being
specific to shell scripts) using yasnippets [1], or one of the built-in
methods discussed in (info "(autotype)Top").

Bye,
Tassilo

[1] https://github.com/capitaomorte/yasnippet



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

* RE: Shell scripting mode
  2013-10-09  9:16 Shell scripting mode Adrián Martínez Larumbe
  2013-10-09 14:18 ` Tassilo Horn
@ 2013-10-09 14:34 ` Doug Lewan
  2013-10-09 15:59 ` Andreas Röhler
  2013-10-10 13:26 ` Adrián Martínez Larumbe
  3 siblings, 0 replies; 8+ messages in thread
From: Doug Lewan @ 2013-10-09 14:34 UTC (permalink / raw)
  To: Adrián Martínez Larumbe, help-gnu-emacs@gnu.org

You've intrigued me. What sorts of features would you like from sh-script mode?

I'm just an old guy who still thinks of code as text. Anything more (colors, etc.) seems like a gift to me. Expand my horizons!

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

These are my principles and if you don't like them... well, I have others. - Groucho Marx


-----Original Message-----
From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On Behalf Of Adrián Martínez Larumbe
Sent: Wednesday, 2013 October 09 05:17
To: help-gnu-emacs@gnu.org
Subject: Shell scripting mode

Hello everyone, this is my very first post on this list.
Since I use emacs for all of my code editing tasks, I wanted to turn it
into my environment of choice for developing bash shell
scripts. However, the major mode that ships with emacs seems fairly
feature-limited, and I was wondering if anybody knows any replacements
that would somehow mimic what vim users enjoy with this extension:

http://vim.sourceforge.net/scripts/script.php?script_id=365




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

* Re: Shell scripting mode
  2013-10-09  9:16 Shell scripting mode Adrián Martínez Larumbe
  2013-10-09 14:18 ` Tassilo Horn
  2013-10-09 14:34 ` Doug Lewan
@ 2013-10-09 15:59 ` Andreas Röhler
  2013-10-10 13:26 ` Adrián Martínez Larumbe
  3 siblings, 0 replies; 8+ messages in thread
From: Andreas Röhler @ 2013-10-09 15:59 UTC (permalink / raw)
  To: help-gnu-emacs

Am 09.10.2013 11:16, schrieb Adrián Martínez Larumbe:
> Hello everyone, this is my very first post on this list.
> Since I use emacs for all of my code editing tasks, I wanted to turn it
> into my environment of choice for developing bash shell
> scripts. However, the major mode that ships with emacs seems fairly
> feature-limited, and I was wondering if anybody knows any replacements
> that would somehow mimic what vim users enjoy with this extension:
>
> http://vim.sourceforge.net/scripts/script.php?script_id=365
>
>

sh-werkstatt.el

implements the following

sh-beginning-of-statement
sh-end-of-statement
sh-mark-function
sh-kill-function
sh-beginning-of-form
sh-end-of-form
sh-beginning-of-function
sh-end-of-function
sh-match-paren
sh-beginning-of-comment

Source:
http://bazaar.launchpad.net/~a-roehler/s-x-emacs-werkstatt/trunk/view/head:/sh-werkstatt.el

It needs a parser delivered at the same place:

beg-end.el


Bug-reports, feature-requests welcome at

https://bugs.launchpad.net/s-x-emacs-werkstatt





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

* Re: Shell scripting mode
  2013-10-09  9:16 Shell scripting mode Adrián Martínez Larumbe
                   ` (2 preceding siblings ...)
  2013-10-09 15:59 ` Andreas Röhler
@ 2013-10-10 13:26 ` Adrián Martínez Larumbe
  2013-10-10 14:01   ` Doug Lewan
                     ` (2 more replies)
  3 siblings, 3 replies; 8+ messages in thread
From: Adrián Martínez Larumbe @ 2013-10-10 13:26 UTC (permalink / raw)
  To: help-gnu-emacs

This is a short wishlist I've compiled that pretty much sums up
everything I was looking for when I wrote the post:

- Code completion of shell bultins and previously defined functions
        (I guess this could be done by writing a wordlist for autocomplete mode)
- Navigation: imenu, buffer definitions, etags, gtags?
        (I'm wondering whether etags has shell scripting support, I'll
        look this up myself)
- Flymake for shell
        (There seems to be a mode for this on elpa repositories)
- Interaction with lower process
        (It'd be awesome if I could send arbitrary regions into the
        shell for immediate execution)
- Online Documentation of shell builtins
        (I guess the best way is turning to woman and reading the
        matching section)
- Yassnippet library
        (The sh scripting mode that ships with emacs has predefined
        functions for skeletons of common constructs, but I think this
        is unnecessary if you put it all into a yasnipet mode directory)




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

* RE: Shell scripting mode
  2013-10-10 13:26 ` Adrián Martínez Larumbe
@ 2013-10-10 14:01   ` Doug Lewan
  2013-10-10 17:56   ` Stefan Monnier
  2013-10-10 20:27   ` Bob Proulx
  2 siblings, 0 replies; 8+ messages in thread
From: Doug Lewan @ 2013-10-10 14:01 UTC (permalink / raw)
  To: Adrián Martínez Larumbe, help-gnu-emacs@gnu.org

Thanks for the list.

Some of your suggestions are almost there already. (And maybe that's why they're not all there. The community may have settled for "good enough".)

Here are my thoughts:

- Code completion ...
    M-/ comes close. I agree that something shell-specific would be a good thing. 
    Handling previously defined functions from other files might be tricky.
    After all, which previously defined function from which other file sounds a little vague to me.
- Navigation ...
    Exuberant ctags should do exactly what you want.
    (I don't think the etags that comes with emacs handles shell, but I could be wrong.)
- Flymake for shell
    Not there. This would be *very* useful.
    Shells are so full of syntax that it's often very hard to find a mistake.
- Interaction with lower process
    This would be very useful too. And probably not hard to write. 
    All the screwy syntax might mess such a thing up. 
    (Think unterminated string or an unterminated ${variable.)
    A command like M-x sh-eval-region that always starts (and terminates) a clean shell might work though.
- Online Documentation of shell builtins
    Info for bash is pretty good.
    Something that navigates it directly would indeed be nice.
    As far as other shells go, it's probably a hard thing to do.
    You'd have to get all the authors/publishers to definitively declare their help locations, formats, etc.
    Better yet, they could all agree on one location, one format, etc. (Ha! I made a joke!)
- Yassnippet library
    Personally I'm happy typing almost everything in shell.
    (The exception is option handling. 
    I never remember if getopt or getopts is the built-in, and that's the one I want.)
    I don't happen to know yassnippet since I use very few emacs applications that aren't delivered with emacs.
    Sorry.

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

These are my principles and if you don't like them... well, I have others. - Groucho Marx


-----Original Message-----
From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On Behalf Of Adrián Martínez Larumbe
Sent: Thursday, 2013 October 10 09:27
To: help-gnu-emacs@gnu.org
Subject: Re: Shell scripting mode

This is a short wishlist I've compiled that pretty much sums up
everything I was looking for when I wrote the post:

- Code completion of shell bultins and previously defined functions
        (I guess this could be done by writing a wordlist for autocomplete mode)
- Navigation: imenu, buffer definitions, etags, gtags?
        (I'm wondering whether etags has shell scripting support, I'll
        look this up myself)
- Flymake for shell
        (There seems to be a mode for this on elpa repositories)
- Interaction with lower process
        (It'd be awesome if I could send arbitrary regions into the
        shell for immediate execution)
- Online Documentation of shell builtins
        (I guess the best way is turning to woman and reading the
        matching section)
- Yassnippet library
        (The sh scripting mode that ships with emacs has predefined
        functions for skeletons of common constructs, but I think this
        is unnecessary if you put it all into a yasnipet mode directory)





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

* Re: Shell scripting mode
  2013-10-10 13:26 ` Adrián Martínez Larumbe
  2013-10-10 14:01   ` Doug Lewan
@ 2013-10-10 17:56   ` Stefan Monnier
  2013-10-10 20:27   ` Bob Proulx
  2 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2013-10-10 17:56 UTC (permalink / raw)
  To: help-gnu-emacs

> This is a short wishlist I've compiled that pretty much sums up
> everything I was looking for when I wrote the post:
> - Code completion of shell bultins and previously defined functions
>         (I guess this could be done by writing a wordlist for autocomplete mode)

That would be nice, indeed.  Patches welcome.

> - Navigation: imenu, buffer definitions, etags, gtags?
>         (I'm wondering whether etags has shell scripting support, I'll
>         look this up myself)

AFAIK there is already imenu support.  Patches for etags support would
be welcome.

> - Flymake for shell
>         (There seems to be a mode for this on elpa repositories)

Not sure how this would work, but would be nice, indeed.

> - Interaction with lower process
>         (It'd be awesome if I could send arbitrary regions into the
>         shell for immediate execution)

There's M-x sh-show-shell RET
and M-x sh-send-line-or-region-and-step RET

> - Online Documentation of shell builtins
>         (I guess the best way is turning to woman and reading the
>         matching section)

Support for info-lookup (which would hence be used via C-h S) would be
welcome, indeed.  Should be pretty easy to do.  Patches welcome.

> - Yassnippet library
>         (The sh scripting mode that ships with emacs has predefined
>         functions for skeletons of common constructs, but I think this
>         is unnecessary if you put it all into a yasnipet mode directory)

The same goes the other way: the YAsnippet snippets are made unnecessary
by the skeletons provided.  Some people prefer one, others prefer the
other, but fundamentally they're basically the same thing.  So, please
tell us what *behavior* (rather than underlying library) you'd like to
see, and maybe you can get that from the provided skeletons.


        Stefan




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

* Re: Shell scripting mode
  2013-10-10 13:26 ` Adrián Martínez Larumbe
  2013-10-10 14:01   ` Doug Lewan
  2013-10-10 17:56   ` Stefan Monnier
@ 2013-10-10 20:27   ` Bob Proulx
  2 siblings, 0 replies; 8+ messages in thread
From: Bob Proulx @ 2013-10-10 20:27 UTC (permalink / raw)
  To: help-gnu-emacs

Adrián Martínez Larumbe wrote:
> - Online Documentation of shell builtins
>         (I guess the best way is turning to woman and reading the
>         matching section)

Just noting that bash comes with help for the builtins.  Meaning that
you can ask bash for help with "help foo" such as "help read".
Meaning that bash documentation for read is "M-! help read Enter".
(AKA ESC-! help read Enter.)

Bob





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

end of thread, other threads:[~2013-10-10 20:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-09  9:16 Shell scripting mode Adrián Martínez Larumbe
2013-10-09 14:18 ` Tassilo Horn
2013-10-09 14:34 ` Doug Lewan
2013-10-09 15:59 ` Andreas Röhler
2013-10-10 13:26 ` Adrián Martínez Larumbe
2013-10-10 14:01   ` Doug Lewan
2013-10-10 17:56   ` Stefan Monnier
2013-10-10 20:27   ` Bob Proulx

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).