[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] OT: Newlines in file names (was: PS file in org-mode distribut
From: |
Christian Schlauer |
Subject: |
[Orgmode] OT: Newlines in file names (was: PS file in org-mode distribution/auto-mode-alist and `$') |
Date: |
Mon, 23 Jul 2007 20:54:54 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Carsten Dominik <address@hidden> writes:
> On Jul 15, 2007, at 22:51, Christian Schlauer wrote:
[...]
>> ,----
>> | The "end of string" mark should be "\\'" rather than "$" (which
>> | means "end of line").
>> `----
>
> Well, $ means end of line, and if the string being tested
> is a single line (as every single file name I have encountered
> so far is)
I agree with you -- I think it is extreeemely exotic, too, I only
became aware of this when I read in the documentation of `find':
,----[ (info "(find)Print File Name") ]
| If there is the faintest possibility that one of the files for which
| you are searching might contain a newline, you should use `-print0'
| instead.
`----
Nevertheless, such file names are quite easy to create: `C-x C-f foo
C-q C-j bar.txt'.
> So while of course you have to be aware that $ can match somewhere
> in the middle of a multiline string, I completely disagree that one
> should not use use $ under such circumstances - it is such a nice
> and compact way to write things (too many backslashes in Emacs
> regular expressions anyway...).
>
> Anyway, as you point out, they do ask for this in the
> documentation, so I'll play along.
Thank you. Sorry for appearing to be nitpicking -- I only brought this
up because I try to understand the elisp (and the regexps) that I put
in my .emacs and the different styles used by different authors can be
confusing:
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist))
Now, at least the regexp is the same. And I always use `add-to-list'
because
,----[ C-h f add-to-list RET ]
| (add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)
|
| Add ELEMENT to the value of LIST-VAR if it isn't there yet.
`----