emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: include Ada Reference Manual info files in ada-mode ELPA package?


From: David Kastrup
Subject: Re: include Ada Reference Manual info files in ada-mode ELPA package?
Date: Sun, 28 Sep 2014 16:51:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Stephen Leake <address@hidden> writes:

> Andreas Schwab <address@hidden> writes:
>
>> Stephen Leake <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]