all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* regexp NOT matching an extension
@ 2003-09-16  1:45 Leo
  2003-09-16  8:03 ` Oliver Scholz
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Leo @ 2003-09-16  1:45 UTC (permalink / raw)


hi there

in dired-omit-files i need a regexp matching all files without the extension
'.pem'.

i tried
    [^.][^p][^e][^m]$
but it doesn't work. however a one-char-negation like
    [^m]$
works.

any idea?

thanks, leo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: regexp NOT matching an extension
  2003-09-16  1:45 regexp NOT matching an extension Leo
@ 2003-09-16  8:03 ` Oliver Scholz
  2003-09-16  9:30 ` rendering a string as a new line? Janusz S. Bień
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Oliver Scholz @ 2003-09-16  8:03 UTC (permalink / raw)


"Leo" <leo.broska@NOSPAM.isys.com.au> writes:

> hi there
>
> in dired-omit-files i need a regexp matching all files without the extension
> '.pem'.
>
> i tried
>     [^.][^p][^e][^m]$
> but it doesn't work. however a one-char-negation like
>     [^m]$
> works.
>
> any idea?
>
> thanks, leo

"\\(?:[^.]...\\|\\.[^p]..\\|\\.p[^e].\\|\\.pe[^m]\\)$"


[as an aside note to a recent related thread: I think this is still
not what Perl users would expect according to
<84isogutgt.fsf@slowfox.is.informatik.uni-duisburg.de>, since it
simply matches any four character sequence not identical to
".pem". However, I start to wonder whether x\\(!:top\\)y is actually
still a _regular_ and not rather a _context free_ expression.]

    Oliver
-- 
30 Fructidor an 211 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* rendering a string as a new line?
  2003-09-16  1:45 regexp NOT matching an extension Leo
  2003-09-16  8:03 ` Oliver Scholz
@ 2003-09-16  9:30 ` Janusz S. Bień
  2003-09-16 14:25 ` regexp NOT matching an extension Gareth Rees
       [not found] ` <mailman.294.1063704719.21628.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 17+ messages in thread
From: Janusz S. Bień @ 2003-09-16  9:30 UTC (permalink / raw)



I will have to work systematically with Unicode files which happen to
use some strange tags to represent new line. Is there a way to render
the tags as newlines without explicitly adding the new line
characters?

A solution requiring a CVS version of Emacs is also OK for me.

Best regards

Janusz

-- 
                     ,   
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
jsbien@mimuw.edu.pl, jsbien@uw.edu.pl
http://www.mimuw.edu.pl/~jsbien/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: regexp NOT matching an extension
  2003-09-16  1:45 regexp NOT matching an extension Leo
  2003-09-16  8:03 ` Oliver Scholz
  2003-09-16  9:30 ` rendering a string as a new line? Janusz S. Bień
@ 2003-09-16 14:25 ` Gareth Rees
       [not found] ` <mailman.294.1063704719.21628.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 17+ messages in thread
From: Gareth Rees @ 2003-09-16 14:25 UTC (permalink / raw)


Leo wrote:
> In dired-omit-files I need a regexp matching all files without the
> extension '.pem'.

You need this regexp:

    [^m]$\|[^e]m$\|[^p]em$\|[^.]pem$

Your regexp [^m]$ appears to work because it's the first alternative
that catches most of the files you want to exclude: only files ending in
'm' go on to be considered by the other three cases.

-- 
Gareth Rees

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
       [not found] ` <mailman.294.1063704719.21628.help-gnu-emacs@gnu.org>
@ 2003-09-16 14:43   ` Stefan Monnier
  2003-09-16 18:54     ` Janusz S. Bień
                       ` (2 more replies)
  2003-09-16 18:16   ` Kevin Rodgers
  1 sibling, 3 replies; 17+ messages in thread
From: Stefan Monnier @ 2003-09-16 14:43 UTC (permalink / raw)


> I will have to work systematically with Unicode files which happen to
> use some strange tags to represent new line. Is there a way to render
> the tags as newlines without explicitly adding the new line
> characters?

You can put a string "\n" as a `display' property on those tags.

You might also be able to get your way using `compose-region'
... ah no, you'd get the 10th glyph of your ascii font (which might
display some kind of LF).

As for how to put that `display' property, well you could use font-lock.

But all in all, I'd say it's probably better to write up a coding-system
that maps those tags to/from \n.  Ask a coding-system guru how to do that.


        Stefan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
       [not found] ` <mailman.294.1063704719.21628.help-gnu-emacs@gnu.org>
  2003-09-16 14:43   ` rendering a string as a new line? Stefan Monnier
@ 2003-09-16 18:16   ` Kevin Rodgers
  1 sibling, 0 replies; 17+ messages in thread
From: Kevin Rodgers @ 2003-09-16 18:16 UTC (permalink / raw)


Janusz S. Bien' wrote:

> I will have to work systematically with Unicode files which happen to
> use some strange tags to represent new line. Is there a way to render
> the tags as newlines without explicitly adding the new line
> characters?

If the tag is a single character, you could set up a display table that

has a newline in that character's glyph.  If the tag is more than 1
character (e.g. an XML tag), you could put an overlay on it that specifies
a before-string or after-string property with a newline.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-16 14:43   ` rendering a string as a new line? Stefan Monnier
@ 2003-09-16 18:54     ` Janusz S. Bień
  2003-09-18  4:38     ` Janusz S. Bień
       [not found]     ` <mailman.373.1063863891.21628.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 17+ messages in thread
From: Janusz S. Bień @ 2003-09-16 18:54 UTC (permalink / raw)


On Tue, 16 Sep 2003  "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:


[...]

> As for how to put that `display' property, well you could use font-lock.
> 
> But all in all, I'd say it's probably better to write up a coding-system
> that maps those tags to/from \n.  Ask a coding-system guru how to do that.

Thanks for the hints.

The coding-system approach seems too difficult for me, I will try
font-lock first.

Best regards

Janusz

-- 
                     ,   
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
jsbien@mimuw.edu.pl, jsbien@uw.edu.pl
http://www.mimuw.edu.pl/~jsbien/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-16 14:43   ` rendering a string as a new line? Stefan Monnier
  2003-09-16 18:54     ` Janusz S. Bień
@ 2003-09-18  4:38     ` Janusz S. Bień
       [not found]     ` <mailman.373.1063863891.21628.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 17+ messages in thread
From: Janusz S. Bień @ 2003-09-18  4:38 UTC (permalink / raw)
  Cc: help-gnu-emacs

On Tue, 16 Sep 2003  Kevin Rodgers <ihs_4664@yahoo.com> wrote:

> If the tag is more than 1 character (e.g. an XML tag),

That's the case.

> you could put an overlay on it that specifies
> a before-string or after-string property with a newline.

Thanks.

I guess it is what Stefan actually had in mind:

On Tue, 16 Sep 2003  "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:

[...]

> You can put a string "\n" as a `display' property on those tags.

as, if I understand the documentation correctly, "\n" is not a legal
value for `display' property.

Regards

Janusz

-- 
                     ,   
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
jsbien@mimuw.edu.pl, jsbien@uw.edu.pl
http://www.mimuw.edu.pl/~jsbien/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
       [not found]     ` <mailman.373.1063863891.21628.help-gnu-emacs@gnu.org>
@ 2003-09-18  7:19       ` David Kastrup
  2003-09-18  8:52       ` Oliver Scholz
  1 sibling, 0 replies; 17+ messages in thread
From: David Kastrup @ 2003-09-18  7:19 UTC (permalink / raw)


jsbien@mimuw.edu.pl (Janusz S. Bień) writes:

> On Tue, 16 Sep 2003  Kevin Rodgers <ihs_4664@yahoo.com> wrote:
> 
> > If the tag is more than 1 character (e.g. an XML tag),
> 
> That's the case.
> 
> > you could put an overlay on it that specifies
> > a before-string or after-string property with a newline.
> 
> Thanks.
> 
> I guess it is what Stefan actually had in mind:
> 
> On Tue, 16 Sep 2003  "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:
> 
> [...]
> 
> > You can put a string "\n" as a `display' property on those tags.
> 
> as, if I understand the documentation correctly, "\n" is not a legal
> value for `display' property.

I don't know what the documentation has to say about that, but it
_is_ a valid display property according to my experience.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
       [not found]     ` <mailman.373.1063863891.21628.help-gnu-emacs@gnu.org>
  2003-09-18  7:19       ` David Kastrup
@ 2003-09-18  8:52       ` Oliver Scholz
  2003-09-18 15:52         ` Kevin Rodgers
  2003-09-18 19:40         ` Stefan Monnier
  1 sibling, 2 replies; 17+ messages in thread
From: Oliver Scholz @ 2003-09-18  8:52 UTC (permalink / raw)


jsbien@mimuw.edu.pl (Janusz S. Bień) writes:

> On Tue, 16 Sep 2003  Kevin Rodgers <ihs_4664@yahoo.com> wrote:
>
>> If the tag is more than 1 character (e.g. an XML tag),
>
> That's the case.

That would probably rule out a coding system as a more efficient
alternative to font-lock. But you might want to consider using either
format.el or `after-insert-file-functions' and
`write-region-annotate-functions', instead.

[...]
> On Tue, 16 Sep 2003  "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:
>
> [...]
>
>> You can put a string "\n" as a `display' property on those tags.
>
> as, if I understand the documentation correctly, "\n" is not a legal
> value for `display' property.
[...]

It is not documented (so one could indeed argue, that it is not
legal), but it is valid.  

Both valid and documented is '((margin nil) "\n").

    Oliver
-- 
Jour du Génie de l'Année 211 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-18  8:52       ` Oliver Scholz
@ 2003-09-18 15:52         ` Kevin Rodgers
  2003-09-19  4:15           ` Oliver Scholz
  2003-09-19 13:25           ` Janusz S. Bień
  2003-09-18 19:40         ` Stefan Monnier
  1 sibling, 2 replies; 17+ messages in thread
From: Kevin Rodgers @ 2003-09-18 15:52 UTC (permalink / raw)


Oliver Scholz wrote:

> jsbien@mimuw.edu.pl (Janusz S. Bień) writes:
>>On Tue, 16 Sep 2003  "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:
>>>You can put a string "\n" as a `display' property on those tags.
>>>
>>as, if I understand the documentation correctly, "\n" is not a legal
>>value for `display' property.
>>
> [...]
> 
> It is not documented (so one could indeed argue, that it is not
> legal), but it is valid.  
> 
> Both valid and documented is '((margin nil) "\n").

The "Other Display Specs" node of the Emacs Lisp manual says:

| `((margin nil) STRING)'
| `STRING'
|      A display specification of this form means to display STRING
|      instead of the text that has the display specification, at the same
|      position as that text.  This is a special case of marginal display
|      (*note Display Margins::).

Note the simple STRING alternative.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-18  8:52       ` Oliver Scholz
  2003-09-18 15:52         ` Kevin Rodgers
@ 2003-09-18 19:40         ` Stefan Monnier
  2003-09-19  4:19           ` Oliver Scholz
  1 sibling, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2003-09-18 19:40 UTC (permalink / raw)


>>> If the tag is more than 1 character (e.g. an XML tag),
>> That's the case.
> That would probably rule out a coding system as a more efficient
> alternative to font-lock.

What makes you think so ?


        Stefan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-18 15:52         ` Kevin Rodgers
@ 2003-09-19  4:15           ` Oliver Scholz
  2003-09-19 13:25           ` Janusz S. Bień
  1 sibling, 0 replies; 17+ messages in thread
From: Oliver Scholz @ 2003-09-19  4:15 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Oliver Scholz wrote:
[...]
>> It is not documented 
[...]

> The "Other Display Specs" node of the Emacs Lisp manual says:
>
> | `((margin nil) STRING)'
> | `STRING'
[...]
>
> Note the simple STRING alternative.
[...]

Thanks for the correction.  Obviously I have always overlooked the
second line.


    Oliver
-- 
Jour du Génie de l'Année 211 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-18 19:40         ` Stefan Monnier
@ 2003-09-19  4:19           ` Oliver Scholz
  2003-09-19 16:32             ` Stefan Monnier
  0 siblings, 1 reply; 17+ messages in thread
From: Oliver Scholz @ 2003-09-19  4:19 UTC (permalink / raw)


"Stefan Monnier" <monnier@iro.umontreal.ca> writes:

>>>> If the tag is more than 1 character (e.g. an XML tag),

>>> That's the case.

>> That would probably rule out a coding system as a more efficient
>> alternative to font-lock.
>
> What makes you think so ?
[...]

It's more or less a guess. It depends on the actual tag. If it is
indeed an XML tag among other XML tags, then it could be hairy to
write a CCL program. I believe that you could always--as a last
resort--implement a state machine to decode arbitrary tags, using the
`branch' statement from CCL, but it would still be hairy. As I said,
depending on the actual tag.

Hmmm, for example if the newline-tag is <p/>:

(define-ccl-program egoge-test
  '(1 ((r0 = 0)
	(loop 
	 (read r1)
	 (branch r0
		 (if (r1 == ?<)
		     (r0 = 1)
		   (write r1))
		 (if (r1 == ?p)
		     (r0 = 2)
		   ((write ?<)
		    (write r1)
		    (r0 = 0)))
		 (if (r1 == ?/)
		     (r0 = 3)
		   ((write ?<)
		    (write ?p)
		    (write r1)
		    (r0 = 0)))
		 (if (r1 == ?>)
		     ((r0 = 0)
		      (write ?\n))
		   ((write ?<)
		    (write ?p)
		    (write ?/)
		    (write r1)
		    (r0 = 0))))
	 (repeat)))))

;; Testing
(let ((str "<other-tag>lirum</other-tag><p/>larum")
      (vect (make-vector 9 nil)))
  (ccl-execute-on-string 'egoge-test vect str))


The question is, where you draw the line between character encoding
and formatting markup. If those “tags” are rather formatting markup,
then I think it is better to use the functionality already provided by
Emacs for this purpose: either `after-insert-file-functions' and
`write-file-functions' respectively or the functionality provided by
format.el. This has also the benefit that you could put a text
property on the converted newlines to distinguish them from regular
newlines (if there are any) so that there is no ambiguity, when
encoding the buffer again.

This is all very hypothetical. Now I am curious how those tags
actually look like and what the file format in question is.

    Oliver
-- 
Jour du Génie de l'Année 211 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-18 15:52         ` Kevin Rodgers
  2003-09-19  4:15           ` Oliver Scholz
@ 2003-09-19 13:25           ` Janusz S. Bień
  1 sibling, 0 replies; 17+ messages in thread
From: Janusz S. Bień @ 2003-09-19 13:25 UTC (permalink / raw)
  Cc: help-gnu-emacs

On Thu, 18 Sep 2003  Kevin Rodgers <ihs_4664@yahoo.com> wrote:


[...]

> The "Other Display Specs" node of the Emacs Lisp manual says:
> 
> | `((margin nil) STRING)'
> | `STRING'
> |      A display specification of this form means to display STRING
> |      instead of the text that has the display specification, at the same
> |      position as that text.  This is a special case of marginal display
> |      (*note Display Margins::).
> 
> Note the simple STRING alternative.

I've missed this because I've been confused by the statement

        This is a special case of marginal display

and judged the passage as irrelevant.

To say the truth, I still don't understand it. :-(


On Fri, 19 Sep 2003  Oliver Scholz <alkibiades@gmx.de> wrote:


[...]

> This is all very hypothetical. Now I am curious how those tags
> actually look like and what the file format in question is.

The file format is a proprietary format of a little known KOMBI
typesetting system (http://www.3n.com.pl/kombi6.htm) which happens to
be used for the dictionary of 16th century Polish. The system
historically is a WYSIWYG one, but moves gradually toward a markup
system. I am investigating whether useful information about the entry
contents and structures can be extracted from the dictionary files in
this format.

When asking a question, I made an oversimplification. Actually there
is no new line tag at all, the new line is just implied by some
SGML-like tags. For example, the tag used to change the content of the
running head implies the end of the current entry and the beginning of
a new one, so one or even several new lines should be displayed.

Thanks to all of you for your interest and help.

Regards

Janusz

-- 
                     ,   
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
jsbien@mimuw.edu.pl, jsbien@uw.edu.pl
http://www.mimuw.edu.pl/~jsbien/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-19  4:19           ` Oliver Scholz
@ 2003-09-19 16:32             ` Stefan Monnier
  2003-09-20 15:21               ` Oliver Scholz
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2003-09-19 16:32 UTC (permalink / raw)


> It's more or less a guess. It depends on the actual tag. If it is
> indeed an XML tag among other XML tags, then it could be hairy to
> write a CCL program. I believe that you could always--as a last
> resort--implement a state machine to decode arbitrary tags, using the
> `branch' statement from CCL, but it would still be hairy. As I said,
> depending on the actual tag.

You can always use post-conversion functions to use regexps.

> This is all very hypothetical. Now I am curious how those tags
> actually look like and what the file format in question is.

Given what he said, I'd say that a few good font-lock patterns
adding a display property should do the trick.


        Stefan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: rendering a string as a new line?
  2003-09-19 16:32             ` Stefan Monnier
@ 2003-09-20 15:21               ` Oliver Scholz
  0 siblings, 0 replies; 17+ messages in thread
From: Oliver Scholz @ 2003-09-20 15:21 UTC (permalink / raw)


"Stefan Monnier" <monnier@iro.umontreal.ca> writes:

>> It's more or less a guess. It depends on the actual tag. If it is
>> indeed an XML tag among other XML tags, then it could be hairy to
>> write a CCL program. I believe that you could always--as a last
>> resort--implement a state machine to decode arbitrary tags, using the
>> `branch' statement from CCL, but it would still be hairy. As I said,
>> depending on the actual tag.
>
> You can always use post-conversion functions to use regexps.

Sure, but then why bother to use a coding-system at all?

>> This is all very hypothetical. Now I am curious how those tags
>> actually look like and what the file format in question is.
>
> Given what he said, I'd say that a few good font-lock patterns
> adding a display property should do the trick.
[...]

I agree.

    Oliver
-- 
Jour de la Raison de l'Année 211 de la Révolution
Liberté, Egalité, Fraternité!

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2003-09-20 15:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-16  1:45 regexp NOT matching an extension Leo
2003-09-16  8:03 ` Oliver Scholz
2003-09-16  9:30 ` rendering a string as a new line? Janusz S. Bień
2003-09-16 14:25 ` regexp NOT matching an extension Gareth Rees
     [not found] ` <mailman.294.1063704719.21628.help-gnu-emacs@gnu.org>
2003-09-16 14:43   ` rendering a string as a new line? Stefan Monnier
2003-09-16 18:54     ` Janusz S. Bień
2003-09-18  4:38     ` Janusz S. Bień
     [not found]     ` <mailman.373.1063863891.21628.help-gnu-emacs@gnu.org>
2003-09-18  7:19       ` David Kastrup
2003-09-18  8:52       ` Oliver Scholz
2003-09-18 15:52         ` Kevin Rodgers
2003-09-19  4:15           ` Oliver Scholz
2003-09-19 13:25           ` Janusz S. Bień
2003-09-18 19:40         ` Stefan Monnier
2003-09-19  4:19           ` Oliver Scholz
2003-09-19 16:32             ` Stefan Monnier
2003-09-20 15:21               ` Oliver Scholz
2003-09-16 18:16   ` Kevin Rodgers

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.