[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A true challenge for Emac and Elisp hackers - at Least I think so
From: |
Slawomir Nowaczyk |
Subject: |
Re: A true challenge for Emac and Elisp hackers - at Least I think so |
Date: |
Wed, 12 Oct 2005 16:04:28 +0200 |
On Wed, 12 Oct 2005 15:29:54 +0200
Matthieu Moy <MatthieuNOSPAM.Moy@imag.fr.invalid> wrote:
#> Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:
#>
#> > 2) Write a function which does what you want and bind it to RET key
#> > *) the function should check if buffer name ends with *.c
#>
#> Better: bind this function only in c-mode and c++-mode. No test needed
#> in the command itself.
Well, my system reports c++-mode for *.h files as well. Original
poster specifically asked the function to apply to *.c files only.
#> > *) the function should get current line contents (think of
#> > functions buffer-substring, point, beginning-of-line, etc.)
#>
#> and C-h f looking-at RET. You don't even need to get it in a string.
docstring for looking-at suggests it looks at text after point, while
the needed one seems to be before the point. Sure you can move to the
beginning of line first, but then I fail to see the benefit...
#> (if (save-excursion
#> (beginning-of-line)
#> (looking-at ".*return;")) ; adapt ...
#> ...
#> ...)
(if (string-match ".*return;"
(buffer-substring (line-beginning-position) (point)))
...
...)
Well, OK, your version is shorter :)
#> > And also, try "C-h i C-s elisp RET" :)
#> C-h i m eli TAB RET ;-).
Ah, yes, I always forget this one... Thanks :)
--
Best wishes,
Slawomir Nowaczyk
( slawomir.nowaczyk.847@student.lu.se )
The greatest enemy of a good plan is the dream of a perfect plan.
Re: A true challenge for Emac and Elisp hackers - at Least I think so, Pascal Bourguignon, 2005/10/12
RE: A true challenge for Emac and Elisp hackers - at Least I think so, Drew Adams, 2005/10/12
Re: A true challenge for Emac and Elisp hackers - at Least I think so, Thien-Thi Nguyen, 2005/10/12