unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Defining  functions on the fly
Date: Tue, 16 Jun 2015 11:22:20 +0200	[thread overview]
Message-ID: <557FEACC.3030101@easy-emacs.de> (raw)
In-Reply-To: <87lhfkjfvr.fsf@gnu.org>


Am 16.06.2015 um 09:01 schrieb Tassilo Horn:
> Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>
>>>> i'm probably misunderstanding you, but does:
>>>>      (defun (intern (concat "current-prefix-" foo) ...
>>>> do what you need?
>>> (defalias (intern (concat "current-prefix-" foo) ...) ...) can work, but
>>> not with defun.  In any case, some concrete example of what he needs to
>>> do would go a long way.
>>>
>>>
>>>           Stefan
>> Currently Emacs provides some scheme to fontify source code and some
>> basic moves: linewise, symbol, word, paragraph, sexp.
>>
>> There is no idea of statement, block/loop or expression and a poor
>> top-level --beginning/end-of-defun.
> There is: `forward-sexp' and `backward-sexp'.  Although the name sexp is
> a bit lisp-specific, sexp-based motion has been implemented for more
> C-like languages, too.  For example, it works well for shell scripts

Unfortunatly couldn't experience this. There are several common cases 
within shell-script, where calls to navigate sexp would raise an error.

That's why language-modes have to implement a couple of most basic 
things. See

http://lists.gnu.org/archive/html/emacs-devel/2015-06/msg00013.html

###

vorhanden() {
     for i in "blah" "blub";
     do
         # some comment (note: for compatibility)
     if [ ! -x $i ]; then

###

with cursor last line "if", C-M-b jumps to "for", but should end at "do"
 From "for" ->

Debugger entered--Lisp error: (scan-error "Containing expression ends 
prematurely" 13 13)
   signal(scan-error ("Containing expression ends prematurely" 13 13))
   smie-forward-sexp-command(-1)
   forward-sexp(-1)
   backward-sexp(1)
   call-interactively(backward-sexp nil nil)
   command-execute(backward-sexp)

There are many more spots in this example to trigger error or unexpected 
moves.

Or take this:

###

if [ $# == 0 ]; then
     # some comment (note: for compatibility)
     set "" `find .  -maxdepth 1 -type f -name "*.txt" | sed 
's/..\(.*\)/\1/'`

     for i in $*; do
         # some comment (note: for compatibility)
     pass
     done

fi

###

With cursor at third line, "set", expression is not recognised at all, 
C-M-f stops at the end of symbol "set"

That's a fakir's mode :)





  reply	other threads:[~2015-06-16  9:22 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15  9:24 Defining functions on the fly Andreas Röhler
2015-06-15  9:32 ` Dmitry Gutov
2015-06-15  9:47 ` Alexis
2015-06-15 10:20   ` Andreas Röhler
2015-06-15 10:37     ` Alexis
2015-06-15 10:41     ` Michael Heerdegen
2015-06-15 10:42     ` Tassilo Horn
2015-06-15 11:01       ` Alexis
2015-06-15 11:19       ` Michael Heerdegen
2015-06-15 11:24         ` Tassilo Horn
2015-06-15 11:31           ` Michael Heerdegen
2015-06-15 10:00 ` Tassilo Horn
2015-06-15 10:33   ` Andreas Röhler
     [not found] ` <mailman.5022.1434361680.904.help-gnu-emacs@gnu.org>
2015-06-15 12:52   ` Stefan Monnier
2015-06-16  5:59     ` Andreas Röhler
2015-06-16  7:01       ` Tassilo Horn
2015-06-16  9:22         ` Andreas Röhler [this message]
2015-06-16 11:12           ` Tassilo Horn
2015-06-16 11:40             ` Andreas Röhler
2015-06-16 13:10               ` Tassilo Horn
2015-06-16 15:46                 ` Andreas Röhler
     [not found]                 ` <mailman.5109.1434469628.904.help-gnu-emacs@gnu.org>
2015-06-16 22:34                   ` Stefan Monnier
     [not found]             ` <mailman.5090.1434454815.904.help-gnu-emacs@gnu.org>
2015-06-16 16:13               ` Pascal J. Bourguignon
2015-06-16 18:30                 ` Andreas Röhler
2015-06-16  9:42         ` Andreas Röhler
     [not found]         ` <mailman.5084.1434446560.904.help-gnu-emacs@gnu.org>
2015-06-16  9:50           ` Pascal J. Bourguignon
2015-06-16 10:26             ` Andreas Röhler
     [not found]             ` <mailman.5087.1434450412.904.help-gnu-emacs@gnu.org>
2015-06-16 11:35               ` Pascal J. Bourguignon
     [not found]         ` <mailman.5085.1434447782.904.help-gnu-emacs@gnu.org>
2015-06-16 22:32           ` Stefan Monnier
     [not found]     ` <mailman.5075.1434434385.904.help-gnu-emacs@gnu.org>
2015-06-16 22:23       ` Stefan Monnier
2015-06-17  6:13         ` Andreas Röhler
     [not found]         ` <mailman.5137.1434522533.904.help-gnu-emacs@gnu.org>
2015-06-17 14:30           ` Stefan Monnier
2015-06-17 16:40             ` Andreas Röhler
     [not found] <mailman.5020.1434360277.904.help-gnu-emacs@gnu.org>
2015-06-15  9:57 ` Pascal J. Bourguignon
2015-06-15 11:21   ` Andreas Röhler
2015-06-15 11:52     ` Tassilo Horn
2015-06-15 12:06       ` Andreas Röhler
2015-06-15 12:43       ` Andreas Röhler
2015-06-15 23:51 ` Gene
2015-06-16  1:14   ` Stefan Monnier
2015-06-17  0:24     ` Gene
2015-06-17  1:12       ` Stefan Monnier
2015-06-16  5:47   ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=557FEACC.3030101@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).