I read A Curious Progammer's post on customizing dabbrev - specifically to skip certain regular expressions at the front of words.
I remember customizing it for Tcl to avoid looking at the $ used to dereference variables. But, I no longer use dabbrev, I use the slightly more general hippie-expand. However, hippie-expand doesn't use the dabbrev settings.
So, the question is, can you get hippie-expand to do the same thing? The answer is, "yes" of course.
hippie-expand does things slightly differently - a little cleaner IMO. It uses syntax tables to determine what to skip. And, since syntax tables are set up appropriately for every mode, the skipping does what you want w/out having to potentially customize a regexp for each mode.
Syntax tables are Emacs' way of encoding the syntactic use of each character in a buffer, and this knowledge is used for motion and regular expressions. That's how forward-word has reasonable meaning in the various programming modes, text mode, shell mode, etc. Similarly, the syntax tables define list motion.
The syntax table has the basic character types: whitespace, punctuation, word, symbol, open/close parenthesis, string, comment start/end, etc. For example, the alpha-numeric characters are generally word constituents. In html-mode the <> symbols are matching parentheses, but in most other programming modes they are punctuation characters.
The variable you set is hippie-expand-dabbrev-as-symbol
, which defaults to t
. Basically, if non-nil, hippie-expand will try to expand the word under the point including symbol characters, which is not what I personally want. I want to only expand the word characters under my point, so I've set it to nil
.(setq hippie-expand-dabbrev-as-symbol nil)
Tuesday, May 19, 2009
Emacs Tip #29: customizing hippe-expand
Posted by a at 11:12 AM 1 comments
Labels: emacs, emacs-intermediate, emacs-tip, link
Friday, May 15, 2009
Stupid VNC Trick
At my office I have a dual monitor setup, and at home I have two monitors as well, so most of my VNC sessions are wide (3280 pixels).
Which presents a problem on the occasions I decide to work from a coffee shop or some other place where I only have my laptop's screen. How do you effectively interact with a VNC session where the session is twice the size of the physical screen?
Clearly scrolling the screen with the mouse is a lose.
My solution is to have two VNC viewers running simultaneously. One shows the right half of the session, and the other shows the left half. That way I can easily CTRL-TAB from one side to the other.
Simple, but pretty effective.
Posted by a at 12:09 PM 1 comments
Labels: vnc