all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "John W. Eaton" <jwe@bevo.che.wisc.edu>
To: Glenn Morris <rgm@gnu.org>
Cc: Kurt.Hornik@wu-wien.ac.at, emacs-devel@gnu.org,
	GAIL <gail@tnp-online.de>,
	rms@gnu.org, "John W. Eaton" <jwe@bevo.che.wisc.edu>
Subject: Re: [gail@tnp-online.de: octave-mod.el: wrong indentation for "IF",  "FOR", etc.]
Date: Thu, 11 Oct 2007 21:57:22 -0400	[thread overview]
Message-ID: <18190.54402.978037.548816@segfault.lan> (raw)
In-Reply-To: <yp8x69xh1f.fsf@fencepost.gnu.org>

On 11-Oct-2007, Glenn Morris wrote:

| "John W. Eaton" wrote:
| 
| > 2007-10-10  John W. Eaton  <jwe@octave.org>
| >
| > 	* progmodes/octave-mod.el (octave-looking-at-kw,
| > 	octave-re-search-forward-kw, octave-re-search-backward-kw):
| > 	New functions.
| 
| Why so complicated - why not just let-bind case-fold search in the
| functions that need it?

I wanted to avoid repeating the same code in multiple places.  Isn't
that what subroutines/functions are for?  But in any case, my Emacs
Lisp skills are minimal.  That's one of the reasons I would like for
octave-*.el to live only in the Emacs distribution instead of also in
the Octave sources.  That way, maybe someone who knows Emacs Lisp
better than I can take over maintenance. So please fix it as you see
fit.

| > +(defun octave-re-search-forward-kw (regexp)
| > +  (let ((case-fold-search nil))
| > +    (re-search-forward regexp nil 'move inc)))
| > +
| > +(defun octave-re-search-backward-kw (regexp)
| > +  (let ((case-fold-search nil))
| > +    (re-search-backward regexp nil 'move inc)))
| 
| It seems ugly to (ab)use the variable `inc' in this way. If you do
| want to do it this way, wouldn't it be nicer to use something like:
| 
| (defun octave-re-search-forward (regexp &optional bound noerror count)
|   "Like `re-search-forward', but sets `case-fold-search' nil."
|   (let (case-fold-search)
|      (re-search-forward regexp bound noerror count)))

All the uses of these function are searching for kewords, which is why
I appended the -kw to the name.  I thought it best to simplify the
interface to only what is needed.  I missed inc, so yes, it should
also appear in the argument list.  But since the other two arguments
are always nil and 'move in this context, I don't see why they
need to be exposed in the argument list of the new functions.

jwe

  reply	other threads:[~2007-10-12  1:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1If3fk-0003hN-Nr@fencepost.gnu.org>
     [not found] ` <18188.40056.604794.828796@mithrandir.hornik.net>
2007-10-10 15:38   ` [gail@tnp-online.de: octave-mod.el: wrong indentation for "IF", "FOR", etc.] John W. Eaton
2007-10-11  5:20     ` Richard Stallman
2007-10-12  1:23     ` Glenn Morris
2007-10-12  1:57       ` John W. Eaton [this message]
2007-10-12 15:59       ` Richard Stallman

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

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

  git send-email \
    --in-reply-to=18190.54402.978037.548816@segfault.lan \
    --to=jwe@bevo.che.wisc.edu \
    --cc=Kurt.Hornik@wu-wien.ac.at \
    --cc=emacs-devel@gnu.org \
    --cc=gail@tnp-online.de \
    --cc=rgm@gnu.org \
    --cc=rms@gnu.org \
    /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.
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.