unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se>
Subject: Re: A true challenge for Emac and Elisp hackers - at Least I think	so
Date: Wed, 12 Oct 2005 16:04:28 +0200	[thread overview]
Message-ID: <20051012155338.23DF.SLAWOMIR.NOWACZYK.847@student.lu.se> (raw)
In-Reply-To: <vpq64s2g8x9.fsf@ecrins.imag.fr>

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.

  reply	other threads:[~2005-10-12 14:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-12 11:48 A true challenge for Emac and Elisp hackers - at Least I think so Sune
2005-10-12 12:49 ` Gian Uberto Lauri
2005-10-12 13:16 ` Slawomir Nowaczyk
     [not found] ` <mailman.11019.1129123023.20277.help-gnu-emacs@gnu.org>
2005-10-12 13:29   ` Matthieu Moy
2005-10-12 14:04     ` Slawomir Nowaczyk [this message]
     [not found]     ` <mailman.11022.1129125880.20277.help-gnu-emacs@gnu.org>
2005-10-12 16:13       ` Giorgos Keramidas
2005-10-12 19:20         ` Chris McMahan
2005-10-12 13:48 ` Pascal Bourguignon
2005-10-12 15:36 ` Drew Adams
2005-10-12 23:28 ` Thien-Thi Nguyen
2005-10-13  9:13   ` Sune
2005-10-13 14:33     ` Joe Corneli
2005-10-13 21:45   ` Sune
2005-10-13 21:49   ` Sune
2005-10-14 13:10     ` Thien-Thi Nguyen
2005-10-15 17:57   ` Sune
2005-10-15 19:57     ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051012155338.23DF.SLAWOMIR.NOWACZYK.847@student.lu.se \
    --to=slawomir.nowaczyk.847@student.lu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).