hi all,
it there something like an auto paren mode in xemacs? if i open a paren (, {
or [ it should be immediately closed.
thanks,
Klaus
it there something like an auto paren mode in xemacs? if i open a paren (, {
or [ it should be immediately closed.
thanks,
Klaus
Klaus> hi all,
Klaus> it there something like an auto paren mode in xemacs? if i
Klaus> open a paren (, { or [ it should be immediately closed.
This depends on the major-mode you are using.
cperl has the concept of
* cperl-electric-parens - Non-nil (and non-null) means parentheses should be electric in CPerl.
which see.
There's also "Balanced Editing"
like
M-( (insert-parentheses)
and
M-) (move-past-close-and-reindent)
Try
C-x C-e (eval-last-sexp)
at the end of following line:
(Info-goto-node "(xemacs)Balanced Editing")
Hope this helps,
Adrian
Klaus> thanks,
Klaus> Klaus
--
Adrian Aichner
http://www.xemacs.org/
I'm using the this:Quote:// Klaus Leopold writes:
> it there something like an auto paren mode in xemacs? if i open a paren (, {
> or [ it should be immediately closed.
(defun my-dbl-brace ()
(interactive)
(cond ((looking-at "\\b")
(insert "{"))
(t
(insert "{}")
(forward-char -1))))
(defun my-dbl-paren ()
(interactive)
(cond ((looking-at "\\b")
(insert "("))
(t
(insert "()")
(forward-char -1))))
(defun my-dbl-bracket ()
(interactive)
(cond ((looking-at "\\b")
(insert "["))
(t
(insert "[]")
(forward-char -1))))
(defun my-dbl-angle ()
(interactive)
(cond ((looking-at "\\b")
(insert "<"))
(t
(insert "<>")
(forward-char -1))))
This just inserts double parens if the cursor is not located before a
word. If it is just a the opening paren is inserted. I found this to be
more convenient than blindly inserting a pair of parens.
--
Ciao, Sebastian
* HP: http://www.sauerland.de/~toyland/ PGP-Key available
this is somebody else's:Quote:> hi all,
> it there something like an auto paren mode in xemacs? if i open a
> paren (, { or [ it should be immediately closed.
(defun my-dbl-brace ()
(interactive)
(cond ((looking-at "\[0-9A-Za-z]")
(insert "{"))
(t
(insert "{}")
(forward-char -1))))
(defun my-dbl-paren ()
(interactive)
(cond ((looking-at "\\b")
(insert "("))
(t
(insert "()")
(forward-char -1))))
(defun my-dbl-bracket ()
(interactive)
(cond ((looking-at "\\b")
(insert "["))
(t
(insert "[]")
(forward-char -1))))
(defun my-dbl-angle ()
(interactive)
(cond ((looking-at "\\b")
(insert "<"))
(t
(insert "<>")
(forward-char -1))))
...Quote:> // Klaus Leopold writes:
>> it there something like an auto paren mode in xemacs? if i open a
>> paren (, { or [ it should be immediately closed.
> I'm using the this:
Just a note that if you want to associate some function like this to a
mode you have to add a mode hook eg, if you want to associate his dbl-
paren function to c:
(add-hook 'c-mode-hook
(lambda()
(define-key haskell-mode-map "(" 'my-dbl-paren))
hmm. perhaps the following would be better:Quote:><snip some function definitions>
>Just a note that if you want to associate some function like this to a
>mode you have to add a mode hook eg, if you want to associate his dbl-
>paren function to c:
>(add-hook 'c-mode-hook
> (lambda()
> (define-key haskell-mode-map "(" 'my-dbl-paren))
(add-hook 'c-mode-hook (lambda (local-set-key "(" 'my-dbl-paren))))
--
bringing you boring signatures for 17 years
Why would this be better?Quote:> hmm. perhaps the following would be better:
> (add-hook 'c-mode-hook (lambda (local-set-key "(" 'my-dbl-paren))))
--
Ciao, Sebastian
* HP: http://www.sauerland.de/~toyland/ PGP-Key available
[previously quoted function restored]Quote:>// those who know me have no need of my name writes:
>Why would this be better?
--
bringing you boring signatures for 17 years
Yes, sorry it was the result of a bad cut and pasting on my part (IQuote:> adding a keystroke to haskell-mode-map probably doesn't have much
> effect on a c-mode buffer. use of `local-set-key' instead of
> `define-key some-map' insures that the keymap for the buffer running
> the hook is modified. there may be times when the later is what is
> desired, but generally it is not. (heck, i even considered suggesting
> (kbd "(") instead of "(".) and last, but not least, it's
> syntactically correct -- the original is missing two trailing close
> parenthesis.
Cheers.
(global-set-key "(" 'my-dbl-paren)
(global-set-key "{" 'my-dbl-brace)
(global-set-key "[" 'my-dbl-bracket)
;-)
thanks again,
klaus
I like that! C-x C-f init.el!Quote:> Thanks a lot for all the postings! it works fine... as i like the
> auto-paren stuff for the whole xemacs and not for a singe mode only i
> used
> (global-set-key "(" 'my-dbl-paren)
> (global-set-key "{" 'my-dbl-brace)
> (global-set-key "[" 'my-dbl-bracket)
Ah, thanks for pointing this out.Quote:> adding a keystroke to haskell-mode-map probably doesn't have much effect on
> a c-mode buffer. use of `local-set-key' instead of `define-key some-map'
> insures that the keymap for the buffer running the hook is modified. there
> may be times when the later is what is desired, but generally it is not.
> (heck, i even considered suggesting (kbd "(") instead of "(".)
--
Ciao, Sebastian
* HP: http://www.sauerland.de/~toyland/ PGP-Key available
if i'm writing a*document it's totally enoying to type the \begin{XXX}
\end{xxx} stuff. is it somehow possible, if i write \begin{whatever...} the
tag \end{whatever...} is automatically written by the great xemacs one line
belos??
like that:
\begin{verbatim}
\end{verbatim}
i guess it's not that easy to do as a singe char, because you'll have to
parse the text...
however, if there's a solution i'd be totally grateful.
Klaus
> if i'm writing a*document it's totally enoying to type the \begin{XXX}
> \end{xxx} stuff. is it somehow possible, if i write \begin{whatever...} the
> tag \end{whatever...} is automatically written by the great xemacs one line
> belos??
> like that:
> \begin{verbatim}
> \end{verbatim}
> i guess it's not that easy to do as a singe char, because you'll have to
> parse the text...
> however, if there's a solution i'd be totally grateful.
--
He was said to have the body of a twenty-five year old, although no one
knew where he kept it.
-- The Life and Times of Corp*Nobbs
(Terry Pratchett, Men at Arms)
> if you use AucTeX (standard with xemacs) that's C-c C-e verbatim<ret>
Klaus
Keywords:
Hi,
my .emacs contains
(require 'paren)
(paren-set-mode 'paren)
and all the corresponding variables are still set to their correct values when
a c-mode buffer comes up. There are no other settings elsewhere in .emacs. But
parenthesis are not highlighted until I do another explicit (paren-set-mode
'paren) for this buffer. Shouldn't this setting be global?
/-/ansi
--
Hans-Juergen Richstein
Scientific Center Heidelberg, IBM Germany
Advanced Radio Communication (ARTe)
Voice: +49-6221-59-4397 FAX:+49-6221-59-3500
2. fortran
3. paren.el enhancement: paren-backwards-message
4. IBM Waverunner V.42bis Compression
5. fixed: (auto) ispell-mode.el which works well w/ auto-fill
6. gifs
7. paren-mode highlighting both matching parenthesis?
8. MSN Messenger and SSDP (Did You Know)
9. something weird with paren-mode
10. show-paren-mode in Xemacs?
11. paren blinking in autoconf-mode
12. vip-paren-match fails in c-mode