command completion - syntax completion

10 views
Skip to first unread message

Jack Reese

unread,
Mar 27, 2001, 7:09:20 PM3/27/01
to

With Brief and Slick editors in the past, I've used a feature that
allowed syntax or command completion. I don't know exactly what the
feature was called, but the idea was simple.

Simply type in a keyword (if, for, while, switch, etc...) and the
perens, braces, case, etc would be filed in automatically and the
cursor positioned with the block ready to begin typing.

If anyone remembers how to do this with emacs, I'd appreciate the help.

Thanks,

Jack Reese

M

unread,
Mar 27, 2001, 10:56:05 PM3/27/01
to
the following works for me, gatehered from this NG:


;;{{{ Either indent according to mode, or expand the word preceding point.
;; I use the text around point as a cue what it is that I want from the
;; editor. Allowance has to be made for the case that point is at the
;; edge of a buffer.
(defun indent-or-expand ()
"Either indent according to mode, or expand the word preceding point."
(interactive)
(if (and
(= ?w (char-syntax (char-before)))
(not (= ?w (char-syntax (char-after)))))
(dabbrev-expand nil)
(indent-according-to-mode))
)

(global-set-key (kbd "TAB") 'indent-or-expand)

;;}}}________________________________________________

"Jack Reese" <re...@byu.edu> wrote in message
news:txitkub...@intractable.cs.byu.edu...

Benjamin Rutt

unread,
Mar 28, 2001, 11:12:43 AM3/28/01
to
Jack Reese <re...@byu.edu> writes:


[...]

> Simply type in a keyword (if, for, while, switch, etc...) and the
> perens, braces, case, etc would be filed in automatically and the
> cursor positioned with the block ready to begin typing.

You may want to use skeletons, they can accomplish this with a little
work. See skeleton.el in your emacs distribution or see

http://fetter.org/emacs/autotype.html.

--
Benjamin

Reply all
Reply to author
Forward
0 new messages