* cc-mode configuration issues
@ 2008-07-14 14:04 Rodrigo Canellas
2008-07-15 3:37 ` Kevin Rodgers
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Rodrigo Canellas @ 2008-07-14 14:04 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I read the CC Mode manual, but I still do not know how to do a couple of
things:
1 -
How to automatically insert a new line when C/C++ code is coming to, for
example, column 78. I was able to do this with comment lines, inserting
" '(c-max-one-liner-length 77)" in my '.emacs', but it does not work for
code.
2 -
I would like to insert a single space after certain characters, such as
'+', '-', '&', '=', etc. I think I can do this with a hook lisp
function, but I do not know how.
Could anyone help me?
Thanks a lot!
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cc-mode configuration issues
2008-07-14 14:04 cc-mode configuration issues Rodrigo Canellas
@ 2008-07-15 3:37 ` Kevin Rodgers
2008-07-15 13:16 ` Rodrigo Canellas
2008-07-15 17:25 ` insert space after specific chars Rodrigo Canellas
[not found] ` <mailman.14781.1216142883.18990.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2008-07-15 3:37 UTC (permalink / raw)
To: help-gnu-emacs
Rodrigo Canellas wrote:
> I read the CC Mode manual, but I still do not know how to do a couple of
> things:
>
> 1 -
> How to automatically insert a new line when C/C++ code is coming to, for
> example, column 78. I was able to do this with comment lines, inserting
> " '(c-max-one-liner-length 77)" in my '.emacs', but it does not work for
> code.
The "Custom Filling and Line Breaking" node hints that you should turn
on auto fill mode and exclude the `code' symbol from c-ignore-auto-fill.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: cc-mode configuration issues
2008-07-15 3:37 ` Kevin Rodgers
@ 2008-07-15 13:16 ` Rodrigo Canellas
0 siblings, 0 replies; 7+ messages in thread
From: Rodrigo Canellas @ 2008-07-15 13:16 UTC (permalink / raw)
To: Kevin Rodgers; +Cc: help-gnu-emacs
Kevin,
Thanks a lot! It works fine!
Kevin Rodgers escreveu:
> Rodrigo Canellas wrote:
>> I read the CC Mode manual, but I still do not know how to do a couple
>> of things:
>>
>> 1 -
>> How to automatically insert a new line when C/C++ code is coming to,
>> for example, column 78. I was able to do this with comment lines,
>> inserting " '(c-max-one-liner-length 77)" in my '.emacs', but it does
>> not work for code.
>
> The "Custom Filling and Line Breaking" node hints that you should turn
> on auto fill mode and exclude the `code' symbol from c-ignore-auto-fill.
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [flat|nested] 7+ messages in thread
* insert space after specific chars
2008-07-14 14:04 cc-mode configuration issues Rodrigo Canellas
2008-07-15 3:37 ` Kevin Rodgers
@ 2008-07-15 17:25 ` Rodrigo Canellas
2008-07-16 21:10 ` Nikolaj Schumacher
[not found] ` <mailman.14781.1216142883.18990.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 7+ messages in thread
From: Rodrigo Canellas @ 2008-07-15 17:25 UTC (permalink / raw)
To: help-gnu-emacs
Hi!
I would like to insert a single space after certain characters, such as
'+', '-', '&', '=', etc.
I think I can do this with a hook lisp function, but I do not know how.
Ideas?
Thanks a lot!
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert space after specific chars
[not found] ` <mailman.14781.1216142883.18990.help-gnu-emacs@gnu.org>
@ 2008-07-15 18:23 ` Pascal J. Bourguignon
2008-07-15 20:00 ` Rodrigo Canellas
0 siblings, 1 reply; 7+ messages in thread
From: Pascal J. Bourguignon @ 2008-07-15 18:23 UTC (permalink / raw)
To: help-gnu-emacs
Rodrigo Canellas <rodrigo.canellas@tqtvd.com> writes:
> I would like to insert a single space after certain characters, such
> as '+', '-', '&', '=', etc.
>
> I think I can do this with a hook lisp function, but I do not know how.
I assume you don't what this to occur everywhere, only in a certain mode.
That means that you will have to locate that mode hook variable (M-x
apropos RET <the-mode> hook RET), and add to it some "meat", that is a
function that will customize the behavior of these keys, by modifying
the local bindings of the buffer.
(defun self-insert-and-space-command ()
(interactive)
(insert last-command-char " "))
M-x local-set-key RET + RET self-insert-and-space-command RET
If it's ok, then define your meat:
(defun <the-mode>-meat ()
(dolist (key (list (kbd "+")
(kbd "-")
(kbd "&")
(kbd "=")))
(local-set-key key 'self-insert-and-space-command)))
Then hook the meat:
(add-hook '<the-mode>-hook '<the-mode>-meat)
When you test the hook, be sure to kill and reopen the buffer, or
directly execute the meat with M-: (<the-mode>-meat) RET
--
__Pascal Bourguignon__ http://www.informatimago.com/
HANDLE WITH EXTREME CARE: This product contains minute electrically
charged particles moving at velocities in excess of five hundred
million miles per hour.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert space after specific chars
2008-07-15 18:23 ` Pascal J. Bourguignon
@ 2008-07-15 20:00 ` Rodrigo Canellas
0 siblings, 0 replies; 7+ messages in thread
From: Rodrigo Canellas @ 2008-07-15 20:00 UTC (permalink / raw)
To: Pascal J. Bourguignon; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/html, Size: 1968 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert space after specific chars
2008-07-15 17:25 ` insert space after specific chars Rodrigo Canellas
@ 2008-07-16 21:10 ` Nikolaj Schumacher
0 siblings, 0 replies; 7+ messages in thread
From: Nikolaj Schumacher @ 2008-07-16 21:10 UTC (permalink / raw)
To: Rodrigo Canellas; +Cc: help-gnu-emacs
Rodrigo Canellas <rodrigo.canellas@tqtvd.com> wrote:
> I would like to insert a single space after certain characters, such as '+',
> -', '&', '=', etc.
>
> I think I can do this with a hook lisp function, but I do not know how.
http://www.emacswiki.org/cgi-bin/emacs-en/SmartOperator
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-07-16 21:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-14 14:04 cc-mode configuration issues Rodrigo Canellas
2008-07-15 3:37 ` Kevin Rodgers
2008-07-15 13:16 ` Rodrigo Canellas
2008-07-15 17:25 ` insert space after specific chars Rodrigo Canellas
2008-07-16 21:10 ` Nikolaj Schumacher
[not found] ` <mailman.14781.1216142883.18990.help-gnu-emacs@gnu.org>
2008-07-15 18:23 ` Pascal J. Bourguignon
2008-07-15 20:00 ` Rodrigo Canellas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).