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