help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: moving in js


From: Andreas Röhler
Subject: Re: moving in js
Date: Fri, 10 Aug 2012 13:15:03 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0

Am 10.08.2012 11:16, schrieb João Távora:
But don't expect a kind of validation from, saying: oh, this list ends here.
It should just pick the next suitable element than.

I do understand the expectation that a move command should do "the
next best thing" and never error. But that is already what C-b and M-b
do.

which is okay for natural languages.
What's needed still is the respective thing for programs: moving over 
expressions.

BTW all this "balanced" or "symbolic" qualifications are futil IMO.

Programs are composed of expressions, Emacs modes should be able to deal with 
it,

nonwithstanding if "4 + 4", "asdf" or "(foo . bar)" are at cursor pos.

As syntax differs, certainly Emacs' move commands can't use a single 
forward-expression implementation for all alike.

So let's start with Emacs lisp, implementing a move-command at finest grain.


(defun foo ()
  (interactive "*")
  nil)

If cursor at the interactive  code characters "*",
C-M-b should not error, but go to the beginning of string first, than at 
word-start interactive, than at
interactive spec (list-beginning).

Agreed?

I'm quite used (and fond of) the errors C-M-b raises, it informs
me about the quality of my code: if I didn't expect an error, it's
because code wasn't structured the way I expected it to be.

I think you would want some kind of command that backward-sexp's when
it can, and when it can't pops *out* of a sexp.

Whereas I wouldn't mind this: a command that backward-sexp's when it
can, and when it can't raises the error. But calling it again
immediately afterwards would pop out of the sexp. A bit like
isearch-forward at the last match.

Maybe I'll try to hack these post them here, I think they can be done
easily with some defadvice.


IMHO its easier to start from scratch.
Happily some wise person provided a forward-sexp-function variable, so
hacking must not interfere with original code.

BTW I'm on it at python-mode.el, using py-expression for the purpose.
Not ready yet, solution is scheduled for 2012-09-04

https://launchpad.net/python-mode/+milestone/6.0.12

Cheers,

Andreas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]