all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: include Ada Reference Manual info files in ada-mode ELPA package?
Date: Sun, 28 Sep 2014 16:51:10 +0200	[thread overview]
Message-ID: <87d2aflrxd.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 85d2afhmkv.fsf@stephe-leake.org

Stephen Leake <stephen_leake@stephe-leake.org> writes:

> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> Stephen Leake <stephen_leake@stephe-leake.org> writes:
>>
>>> --- a/admin/archive-contents.el
>>> +++ b/admin/archive-contents.el
>>> @@ -167,7 +167,7 @@ EXTRAS is an alist with additional metadata.
>>>  
>>>  PKG is the name of the package and DIR is the directory where it is."
>>>    (let* ((mainfile (expand-file-name (concat pkg ".el") dir))
>>> -         (files (directory-files dir nil "\\.el\\'")))
>>> +         (files (directory-files dir nil "^dir$\\|\\.el\\'")))
>>
>> Please use \` and \' instead of ^ and $.
>
> What is the rationale for that?

File names can contain newlines.

> Is it documented somewhere? I looked for an "elisp style guide" in
> emacs/docs/*, and in various READMEs, but didn't see anything obvious.

That's not a question of style.  The meaning is different.  Please check

(info "(Emacs) Regexps")

‘^’
     is a special character that matches the empty string, but only at
     the beginning of a line in the text being matched.  Otherwise it
     fails to match anything.  Thus, ‘^foo’ matches a ‘foo’ that occurs
     at the beginning of a line.

     For historical compatibility reasons, ‘^’ can be used with this
     meaning only at the beginning of the regular expression, or after
     ‘\(’ or ‘\|’.

‘$’
     is similar to ‘^’ but matches only at the end of a line.  Thus,
     ‘x+$’ matches a string of one ‘x’ or more at the end of a line.

     For historical compatibility reasons, ‘$’ can be used with this
     meaning only at the end of the regular expression, or before ‘\)’
     or ‘\|’.

and

(info "(Emacs) Regexp Backslash")

‘\`’
     matches the empty string, but only at the beginning of the string
     or buffer (or its accessible portion) being matched against.

‘\'’
     matches the empty string, but only at the end of the string or
     buffer (or its accessible portion) being matched against.

> I find ^ and $ more readable (I had to look up \', and did not know
> about \`). Although it does make sense to use the same style within one
> regexp.

It's not a question of style but of meaning.

-- 
David Kastrup




  reply	other threads:[~2014-09-28 14:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 20:23 include Ada Reference Manual info files in ada-mode ELPA package? Stephen Leake
2014-09-23 22:28 ` Stefan Monnier
2014-09-24 10:14 ` Richard Stallman
2014-09-24 19:41   ` Stephen Leake
2014-09-24 21:57     ` Richard Stallman
2014-09-28  4:12 ` Stephen Leake
2014-09-28  9:06   ` Andreas Schwab
2014-09-28 14:00     ` Stephen Leake
2014-09-28 14:51       ` David Kastrup [this message]
2014-09-28 15:44         ` Drew Adams
2014-09-28 16:26           ` Stephen Leake
2014-09-28 16:25         ` Stephen Leake
2014-09-28 16:43   ` Stefan Monnier
2014-09-29 13:22     ` Stephen Leake
2014-09-29 13:51       ` Stefan Monnier

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=87d2aflrxd.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=emacs-devel@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.