all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
[parent not found: <mailman.11908.1211307132.18990.help-gnu-emacs@gnu.org>]
* Re: elisp questions for Advanced Closing brackets function
@ 2008-05-21  8:47 Lorenzo Isella
  0 siblings, 0 replies; 12+ messages in thread
From: Lorenzo Isella @ 2008-05-21  8:47 UTC (permalink / raw)
  To: help-gnu-emacs

Dear All,
My questions are even more basic than the ones expressed here.
I would like to do some "trivial" emacs customization.
First of all, I should say I am not a lisp programmer at all and that
my .emacs file
is at the present a patchwork of examples I found online.
Yet, what I would like to do should be quite simple.
A few examples:
(1) I often use auctex, but when I open a tex file I would like to
have pdflatex as
the default, so I would like to skip the tedious C-c C-t C-p.
How can I include this command in the .emacs file? Obviously it should
be executed only when I am opening and reading a .tex file.
(2) Here is something I do not understand.  I found online the
following handy function for automatically inserting another "$" sign
when I type one and moving back the cursor:

   (defun TeX-insert-dollar () "custom redefined insert-dollar" (interactive)
     (insert "$$")       ;in LaTeX mode, typing "$" automatically insert "$$"
     (backward-char 1)) ;and go between them: no more matching problems!

Then, I tried doing something similar when quoting:

   (defun TeX-insert-quote () "custom redefined insert-quote" (interactive)
     (insert "``''")
     (backward-char 2))

and it worked. However, when I tried doing the same with brackets:

   (defun TeX-insert-curly () "custom redefined insert-curly" (interactive)
     (insert "{}")
     (backward-char 1))

I did not get any error message, but it surely does not work on my
system.

Why is that? Is the emacs lisp documentation mentioned in the email I
am quoting the right place to look for answers?
Cheers

Lorenzo



> Message: 5
> Date: Tue, 20 May 2008 11:12:07 -0700 (PDT)
> From: TheLonelyStar <nabble@lonely-star.org>
> Subject: elisp questions for Advanced Closing brackets function
> To: Help-gnu-emacs@gnu.org
> Message-ID: <17346961.post@talk.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> Hi,
>
> I have funtions in my .emacs, which inserts "[]" when one types "[" (and
> same for "(" and "{").
> I also have functions which just jumps over a "]" when "]" is typed.
> I want to make this function more advanced!
> It should do the following:
> When one types "]" it looks for the next character which is NOT a
> whitespace. If it is "]", the functions just jumps after this. Otherwise it
> inserts an "]".
> I am just lerning elisp (just for this), but I am stuck.
> My Problems:
> - How do I check if the character under (point) is a whitespace?
> - In an "if" statement, how do I put more than one expression into the else
> case? Like this:
> (if condition (do-if-case) ((do-else-case) (do-more-else-case))
> - If I have a funcion like this:
> (defun adanced-closing-bracket (arg)
>  ...)
> How do I compare (arg) to the character under point?
>
> Thanks for any help!
> Nathan
> --
> View this message in context: http://www.nabble.com/elisp-questions-for-Advanced-Closing-brackets-function-tp17346961p17346961.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
>
>
>




^ permalink raw reply	[flat|nested] 12+ messages in thread
* elisp questions for Advanced Closing brackets function
@ 2008-05-20 18:12 TheLonelyStar
  2008-05-20 18:24 ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: TheLonelyStar @ 2008-05-20 18:12 UTC (permalink / raw)
  To: Help-gnu-emacs


Hi,

I have funtions in my .emacs, which inserts "[]" when one types "[" (and
same for "(" and "{").
I also have functions which just jumps over a "]" when "]" is typed.
I want to make this function more advanced!
It should do the following:
When one types "]" it looks for the next character which is NOT a
whitespace. If it is "]", the functions just jumps after this. Otherwise it
inserts an "]".
I am just lerning elisp (just for this), but I am stuck.
My Problems:
- How do I check if the character under (point) is a whitespace?
- In an "if" statement, how do I put more than one expression into the else
case? Like this:
(if condition (do-if-case) ((do-else-case) (do-more-else-case))
- If I have a funcion like this:
(defun adanced-closing-bracket (arg)
  ...)
How do I compare (arg) to the character under point?

Thanks for any help!
Nathan
-- 
View this message in context: http://www.nabble.com/elisp-questions-for-Advanced-Closing-brackets-function-tp17346961p17346961.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-05-21 20:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.11944.1211359652.18990.help-gnu-emacs@gnu.org>
2008-05-21 10:28 ` elisp questions for Advanced Closing brackets function Rupert Swarbrick
2008-05-21 10:33   ` Rupert Swarbrick
2008-05-21 18:30 ` Ralf Angeli
2008-05-21 18:40   ` Rupert Swarbrick
2008-05-21 20:14     ` Ralf Angeli
     [not found] <mailman.11908.1211307132.18990.help-gnu-emacs@gnu.org>
2008-05-21  9:09 ` Tim X
2008-05-21  8:47 Lorenzo Isella
  -- strict thread matches above, loose matches on Subject: below --
2008-05-20 18:12 TheLonelyStar
2008-05-20 18:24 ` Drew Adams
2008-05-20 20:04   ` TheLonelyStar
2008-05-20 20:19     ` Drew Adams
2008-05-21  6:18     ` Pierre Lorenzon

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.