* regexp on emacs how to...
@ 2014-08-30 21:01 renato.pontefice
2014-08-30 22:17 ` Thorsten Jolitz
2014-09-01 9:56 ` Nicolas Richard
0 siblings, 2 replies; 23+ messages in thread
From: renato.pontefice @ 2014-08-30 21:01 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I need a regexp, that can help me, on a particular need.
I have a file in .rtf format.
Inside it, with emacs, i insert some code.
All the code that I insert, start with [- and ends with -]
betwwen this two tags I have capital letters, without space and line breack.
I would have a regexp that show me any occurence of this tag, where i.e.:
- there are open tag [-
- name of variable [-VARIABLENAME
but the close tag -] are after a line break
and i.e.
- start tag [-
- some char of variable (written in capital letters) [-VARIABLE
- but before the end tag, some non capital letter (that is .rtf code) [-VARIABLE\rtf\ql\lind34}NAME-]
I hope I have well explained. (if not, ask me more clarifications)
is it possible?
thank you
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-08-30 21:01 regexp on emacs how to renato.pontefice
@ 2014-08-30 22:17 ` Thorsten Jolitz
2014-08-30 22:39 ` Thorsten Jolitz
[not found] ` <mailman.7955.1409438369.1147.help-gnu-emacs@gnu.org>
2014-09-01 9:56 ` Nicolas Richard
1 sibling, 2 replies; 23+ messages in thread
From: Thorsten Jolitz @ 2014-08-30 22:17 UTC (permalink / raw)
To: help-gnu-emacs
renato.pontefice@gmail.com writes:
> Hi,
> I need a regexp, that can help me, on a particular need.
>
> I have a file in .rtf format.
> Inside it, with emacs, i insert some code.
>
> All the code that I insert, start with [- and ends with -]
>
> betwwen this two tags I have capital letters, without space and line
> breack.
>
> I would have a regexp that show me any occurence of this tag, where i.e.:
> - there are open tag [-
> - name of variable [-VARIABLENAME
> but the close tag -] are after a line break
>
> and i.e.
> - start tag [-
> - some char of variable (written in capital letters) [-VARIABLE
> - but before the end tag, some non capital letter (that is .rtf code)
> [-VARIABLE\rtf\ql\lind34}NAME-]
>
> I hope I have well explained. (if not, ask me more clarifications)
>
> is it possible?
This might give some false positives, but not miss any tags:
"\\[-[^^\000]+?-]"
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-08-30 22:17 ` Thorsten Jolitz
@ 2014-08-30 22:39 ` Thorsten Jolitz
[not found] ` <mailman.7955.1409438369.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 23+ messages in thread
From: Thorsten Jolitz @ 2014-08-30 22:39 UTC (permalink / raw)
To: help-gnu-emacs
Thorsten Jolitz <tjolitz@gmail.com> writes:
> This might give some false positives, but not miss any tags:
>
> "\\[-[^^\000]+?-]"
Ups, this should actually be:
"\\[-[^\000]+?-]"
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <mailman.7955.1409438369.1147.help-gnu-emacs@gnu.org>
@ 2014-09-01 8:15 ` renato.pontefice
2014-09-01 8:24 ` Eric Abrahamsen
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: renato.pontefice @ 2014-09-01 8:15 UTC (permalink / raw)
To: help-gnu-emacs
Il giorno domenica 31 agosto 2014 00:39:00 UTC+2, Thorsten Jolitz ha scritto:
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>
>
> > This might give some false positives, but not miss any tags:
>
> >
>
> > "\\[-[^^\000]+?-]"
>
>
>
> Ups, this should actually be:
>
>
>
> "\\[-[^\000]+?-]"
>
>
>
> --
>
> cheers,
>
> Thorsten
It doesen't work :-(
can you try to explain me what kin of search try to do this expression?
TIA
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-01 8:15 ` renato.pontefice
@ 2014-09-01 8:24 ` Eric Abrahamsen
2014-09-01 9:14 ` Thorsten Jolitz
2014-09-01 9:10 ` Thorsten Jolitz
[not found] ` <mailman.8023.1409562921.1147.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 23+ messages in thread
From: Eric Abrahamsen @ 2014-09-01 8:24 UTC (permalink / raw)
To: help-gnu-emacs
renato.pontefice@gmail.com writes:
> Il giorno domenica 31 agosto 2014 00:39:00 UTC+2, Thorsten Jolitz ha scritto:
>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>>
>>
>>
>> > This might give some false positives, but not miss any tags:
>>
>> >
>>
>> > "\\[-[^^\000]+?-]"
>>
>>
>>
>> Ups, this should actually be:
>>
>>
>>
>> "\\[-[^\000]+?-]"
>>
>>
>>
>> --
>>
>> cheers,
>>
>> Thorsten
>
> It doesen't work :-(
>
> can you try to explain me what kin of search try to do this expression?
In cases like this, regexp-builder can often be useful. Go to the buffer
containing your RTF text, M-x regexp-builder, and then start building
your regexp incrementally. Many times this is enough to show you what
was wrong with the original one.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-01 8:15 ` renato.pontefice
2014-09-01 8:24 ` Eric Abrahamsen
@ 2014-09-01 9:10 ` Thorsten Jolitz
[not found] ` <mailman.8023.1409562921.1147.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 23+ messages in thread
From: Thorsten Jolitz @ 2014-09-01 9:10 UTC (permalink / raw)
To: help-gnu-emacs
renato.pontefice@gmail.com writes:
> Il giorno domenica 31 agosto 2014 00:39:00 UTC+2, Thorsten Jolitz ha
> scritto:
>> Thorsten Jolitz <tjolitz@gmail.com> writes:
>> "\\[-[^\000]+?-]"
> It doesen't work :-(
>
> can you try to explain me what kin of search try to do this expression?
Can you just give a simple example of what text you would like to match?
E.g. insert a typical snippet in a lorem ipsum paragraph or so:
#+BEGIN_EXAMPLE
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam nisl,
tincidunt et, mattis eget, [MY SNIPPET] convallis nec, purus. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
accumsan nisl.
#+END_EXAMPLE
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-01 8:24 ` Eric Abrahamsen
@ 2014-09-01 9:14 ` Thorsten Jolitz
0 siblings, 0 replies; 23+ messages in thread
From: Thorsten Jolitz @ 2014-09-01 9:14 UTC (permalink / raw)
To: help-gnu-emacs
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> In cases like this, regexp-builder can often be useful. Go to the buffer
> containing your RTF text, M-x regexp-builder, and then start building
> your regexp incrementally. Many times this is enough to show you what
> was wrong with the original one.
Indeed, a very useful library.
Only caveat in this case: when using [^\000]+ in a regexp and calling
'reb-copy', it is converted to a literal NUL char [^^@]+, which works
perfectly for regexp matching, but makes GIT think your .el file is a
binary file.
I had this problem and had to change all [^^@]+ back to [^\000]+ to
enable correct VC on these files again ... (including some renaming
workarounds).
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-08-30 21:01 regexp on emacs how to renato.pontefice
2014-08-30 22:17 ` Thorsten Jolitz
@ 2014-09-01 9:56 ` Nicolas Richard
[not found] ` <CAF83ECB74PD7An-scqk74gN4YzrGC9DW8at1-cCFzV1utYSFRQ@mail.gmail.com>
1 sibling, 1 reply; 23+ messages in thread
From: Nicolas Richard @ 2014-09-01 9:56 UTC (permalink / raw)
To: renato.pontefice; +Cc: help-gnu-emacs
renato.pontefice@gmail.com writes:
> I would have a regexp that show me any occurence of this tag, where i.e.:
> - there are open tag [-
> - name of variable [-VARIABLENAME
> but the close tag -] are after a line break
Do you really need to do it with a regexp ? Here's some lisp to search
for all these problematic tags.
(while (and (not (eobp)) (search-forward "[-" nil t))
(unless (search-forward "-]" (point-at-eol) 'move)
(message "Problem found, please fix and hit C-M-c to continue")
(recursive-edit)))
If you really want a regexp, you could use
(re-search-forward "\\[-\\([^-]\\|-[^]]\\)*\n")
(i.e. match a "[-" not followed by "-]" on the same line)
At the C-M-% prompt, you can enter the regexp as \[-\([^-]\|-[^]]\)* followed by a
litteral newline, i.e. C-q C-j.
HTH,
--
Nicolas Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <mailman.8023.1409562921.1147.help-gnu-emacs@gnu.org>
@ 2014-09-01 10:11 ` renato.pontefice
2014-09-01 10:28 ` Thorsten Jolitz
2014-09-01 10:38 ` Álvar Ibeas
0 siblings, 2 replies; 23+ messages in thread
From: renato.pontefice @ 2014-09-01 10:11 UTC (permalink / raw)
To: help-gnu-emacs
ok, this is a right code:
#+BEGIN_EXAMPLE
noscenza e competenza, che in }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996\charrsid7868964 [-DATE-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 prot }{\rtlch\fcs1 \af0 \ltrch\fcs0
\f40\fs22\insrsid15731996\charrsid13987552 [-TIME-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 Il/la sig
#+END_EXAMPLE
this is an example with problems
#+BEGIN_EXAMPLE
noscenza e competenza, che in }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996\charrsid7868964 [-DAT{\rtlch\fcs1 \af0 \ltrchE-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 prot }{\rtlch\fcs1 \af0 \ltrch\fcs0
\f40\fs22\insrsid15731996\charrsid13987552 [-TI
ME-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 Il/la sig
#+END_EXAMPLE
In the second example, my variable ([-DATE-] and [-TIME-], are interrupted:
- in [-DATE-] variable, by rtf code
- in [-TIME-] variable, by a a line feed
in both example, the parser that try to substituite variable, fails, becausae it find some dirty text, between the start [- and the end -] of variable.
So I need to detect that occurence.
The best thing would be to detect JUST the occurence of variable that are not well formatted (as in example 1
I think regexp could do that, but I don't know how...
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-01 10:11 ` renato.pontefice
@ 2014-09-01 10:28 ` Thorsten Jolitz
2014-09-01 10:38 ` Álvar Ibeas
1 sibling, 0 replies; 23+ messages in thread
From: Thorsten Jolitz @ 2014-09-01 10:28 UTC (permalink / raw)
To: help-gnu-emacs
renato.pontefice@gmail.com writes:
> ok, this is a right code:
> #+BEGIN_EXAMPLE
> noscenza e competenza, che in }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996\charrsid7868964 [-DATE-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 prot }{\rtlch\fcs1 \af0 \ltrch\fcs0
> \f40\fs22\insrsid15731996\charrsid13987552 [-TIME-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 Il/la sig
> #+END_EXAMPLE
>
> this is an example with problems
> #+BEGIN_EXAMPLE
> noscenza e competenza, che in }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996\charrsid7868964 [-DAT{\rtlch\fcs1 \af0 \ltrchE-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 prot }{\rtlch\fcs1 \af0 \ltrch\fcs0
> \f40\fs22\insrsid15731996\charrsid13987552 [-TI
> ME-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 Il/la sig
> #+END_EXAMPLE
>
> In the second example, my variable ([-DATE-] and [-TIME-], are interrupted:
> - in [-DATE-] variable, by rtf code
> - in [-TIME-] variable, by a a line feed
>
> in both example, the parser that try to substituite variable, fails,
> becausae it find some dirty text, between the start [- and the end -]
> of variable.
>
> So I need to detect that occurence.
> The best thing would be to detect JUST the occurence of variable that
> are not well formatted (as in example 1
>
> I think regexp could do that, but I don't know how...
Hmm ... when I start M-x regexp-builder and insert "\\[-[^\000]+?-]",
and then call M-x reb-force-update, all the variables in you post above
are matched. So this seems to work, but try there more profound advice
from Nicolas too.
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-01 10:11 ` renato.pontefice
2014-09-01 10:28 ` Thorsten Jolitz
@ 2014-09-01 10:38 ` Álvar Ibeas
1 sibling, 0 replies; 23+ messages in thread
From: Álvar Ibeas @ 2014-09-01 10:38 UTC (permalink / raw)
To: help-gnu-emacs
MIME-Version: 1.0
Content-Type: text/plain
\[-[A-Z]*?[^]A-Z]+?[^]]*?-\]
It misses at least those occurrences where the character ] is in the inserted text.
Date: Mon, 01 Sep 2014 12:38:30 +0200
In-Reply-To: <0f557f31-c018-4844-b852-d8be48dda000@googlegroups.com> (renato
pontefice's message of "Mon, 1 Sep 2014 03:11:17 -0700")
Message-ID: <87egvvr5g9.fsf@alveinte.minas.unican.es>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
--text follows this line--
<renato.pontefice@gmail.com> writes:
> ok, this is a right code:
> #+BEGIN_EXAMPLE
> noscenza e competenza, che in }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996\charrsid7868964 [-DATE-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 prot }{\rtlch\fcs1 \af0 \ltrch\fcs0
> \f40\fs22\insrsid15731996\charrsid13987552 [-TIME-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 Il/la sig
> #+END_EXAMPLE
>
> this is an example with problems
> #+BEGIN_EXAMPLE
> noscenza e competenza, che in }{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996\charrsid7868964 [-DAT{\rtlch\fcs1 \af0 \ltrchE-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 prot }{\rtlch\fcs1 \af0 \ltrch\fcs0
> \f40\fs22\insrsid15731996\charrsid13987552 [-TI
> ME-]}{\rtlch\fcs1 \af0 \ltrch\fcs0 \f40\fs22\insrsid15731996 Il/la sig
> #+END_EXAMPLE
>
> In the second example, my variable ([-DATE-] and [-TIME-], are interrupted:
> - in [-DATE-] variable, by rtf code
> - in [-TIME-] variable, by a a line feed
>
> in both example, the parser that try to substituite variable, fails, becausae it find some dirty text, between the start [- and the end -] of variable.
>
> So I need to detect that occurence.
> The best thing would be to detect JUST the occurence of variable that are not well formatted (as in example 1
>
> I think regexp could do that, but I don't know how...
>
> Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <CAF83ECB74PD7An-scqk74gN4YzrGC9DW8at1-cCFzV1utYSFRQ@mail.gmail.com>
@ 2014-09-02 10:53 ` Nicolas Richard
[not found] ` <874mwrrudt.fsf@yahoo.fr>
1 sibling, 0 replies; 23+ messages in thread
From: Nicolas Richard @ 2014-09-02 10:53 UTC (permalink / raw)
To: Renato Pontefice; +Cc: help-gnu-emacs
(please send followups to the mailing list)
Hi,
Renato Pontefice <renato.pontefice@gmail.com> writes:
> for me could be the same (lisp or regexp), but to use lisp Do I need
> some particular installation?
No, elisp --in this context-- stands for "emacs lisp". Many parts of
emacs are written in that language. Every time you hit some keys, they
in fact run an emacs command, most of which are written in elisp.
To test the piece of elisp I have shown, simply hit M-: then yank the
code and hit RET. It will act on the buffer you are in at that moment.
--
Nicolas Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <CAF83ECB2NbV0QdCbd0H8Z-PJB0ZbYboswpjFudc__9JQH+P=1Q@mail.gmail.com>
@ 2014-09-02 11:03 ` Nicolas Richard
[not found] ` <mailman.8096.1409655669.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 23+ messages in thread
From: Nicolas Richard @ 2014-09-02 11:03 UTC (permalink / raw)
To: Renato Pontefice; +Cc: help-gnu-emacs
Le 02/09/2014 09:48, Renato Pontefice a écrit :
> wich coul be the elisp code, than check all the tags ([-.....-]), but,
> from the beginning ([-) to the end (-]) find some non capital letter
> (any one)
I did not give it much testing, but I think this should do it:
(while (and (not (eobp)) (search-forward "[-" nil t))
(skip-chars-forward "A-Z")
(unless (looking-at "-]")
(message "Problem found, please fix and hit C-M-c to continue")
(recursive-edit)))
(I think my previous mail was sent twice, sorry about that.)
--
Nicolas.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <mailman.8096.1409655669.1147.help-gnu-emacs@gnu.org>
@ 2014-09-03 9:24 ` renato.pontefice
2014-09-03 9:25 ` renato.pontefice
0 siblings, 1 reply; 23+ messages in thread
From: renato.pontefice @ 2014-09-03 9:24 UTC (permalink / raw)
To: help-gnu-emacs
Il giorno martedì 2 settembre 2014 13:03:23 UTC+2, Nicolas Richard ha scritto:
> Le 02/09/2014 09:48, Renato Pontefice a écrit :
>
> > wich coul be the elisp code, than check all the tags ([-.....-]), but,
>
> > from the beginning ([-) to the end (-]) find some non capital letter
>
> > (any one)
>
>
>
> I did not give it much testing, but I think this should do it:
>
>
>
> (while (and (not (eobp)) (search-forward "[-" nil t))
>
> (skip-chars-forward "A-Z")
>
> (unless (looking-at "-]")
>
> (message "Problem found, please fix and hit C-M-c to continue")
>
> (recursive-edit)))
>
>
>
> (I think my previous mail was sent twice, sorry about that.)
>
>
>
> --
>
> Nicolas.
(as rightly said Nicolas, I continue the post on the groups. My last two messages:)
Nicolas...I would not be too hasty..... but it seems to work!!!!!!!!!!!!!
I thank you for your help, now Icontinue to try!!!!!
Thanks again
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-03 9:24 ` renato.pontefice
@ 2014-09-03 9:25 ` renato.pontefice
2014-09-03 10:47 ` Nicolas Richard
[not found] ` <mailman.8184.1409741111.1147.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 23+ messages in thread
From: renato.pontefice @ 2014-09-03 9:25 UTC (permalink / raw)
To: help-gnu-emacs
Il giorno mercoledì 3 settembre 2014 11:24:49 UTC+2, renato.p...@gmail.com ha scritto:
> Il giorno martedì 2 settembre 2014 13:03:23 UTC+2, Nicolas Richard ha scritto:
>
> > Le 02/09/2014 09:48, Renato Pontefice a écrit :
>
> >
>
> > > wich coul be the elisp code, than check all the tags ([-.....-]), but,
>
> >
>
> > > from the beginning ([-) to the end (-]) find some non capital letter
>
> >
>
> > > (any one)
>
> >
>
> >
>
> >
>
> > I did not give it much testing, but I think this should do it:
>
> >
>
> >
>
> >
>
> > (while (and (not (eobp)) (search-forward "[-" nil t))
>
> >
>
> > (skip-chars-forward "A-Z")
>
> >
>
> > (unless (looking-at "-]")
>
> >
>
> > (message "Problem found, please fix and hit C-M-c to continue")
>
> >
>
> > (recursive-edit)))
>
> >
>
> >
>
> >
>
> > (I think my previous mail was sent twice, sorry about that.)
>
> >
>
> >
>
> >
>
> > --
>
> >
>
> > Nicolas.
>
>
>
> (as rightly said Nicolas, I continue the post on the groups. My last two messages:)
>
>
>
> Nicolas...I would not be too hasty..... but it seems to work!!!!!!!!!!!!!
>
>
>
> I thank you for your help, now Icontinue to try!!!!!
>
>
>
> Thanks again
>
>
>
> Renato
As I told you before, your code works great. The only things I find that seems not work is:
- when inside the file, there is no error text (\lojkklj\òlllò...)
the cursor, stop him self, at every occurence of [- and I have to press C-M c to reach the end of file.
It could be a good things, that, if there is not any occurence of the error, it arrive at end of file
TIA
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-03 9:25 ` renato.pontefice
@ 2014-09-03 10:47 ` Nicolas Richard
[not found] ` <mailman.8184.1409741111.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 23+ messages in thread
From: Nicolas Richard @ 2014-09-03 10:47 UTC (permalink / raw)
To: renato.pontefice; +Cc: help-gnu-emacs
renato.pontefice@gmail.com writes:
> As I told you before, your code works great. The only things I find that seems not work is:
>
> - when inside the file, there is no error text (\lojkklj\òlllò...)
> the cursor, stop him self, at every occurence of [- and I have to press C-M c to reach the end of file.
>
> It could be a good things, that, if there is not any occurence of the error, it arrive at end of file
I guess I misunderstood know what constitutes an error. Could you
provide examples where the code below stops and shouldn't ?
(while (and (not (eobp)) (search-forward "[-" nil t))
(skip-chars-forward "A-Z")
(unless (looking-at "-]")
(message "Problem found, please fix and hit C-M-c to continue")
(recursive-edit)))
--
Nicolas Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <mailman.8184.1409741111.1147.help-gnu-emacs@gnu.org>
@ 2014-09-04 10:48 ` Renato Pontefice
2014-09-05 12:02 ` Nicolas Richard
[not found] ` <mailman.8325.1409918483.1147.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 23+ messages in thread
From: Renato Pontefice @ 2014-09-04 10:48 UTC (permalink / raw)
To: help-gnu-emacs
Il giorno mercoledì 3 settembre 2014 12:47:22 UTC+2, Nicolas Richard ha scritto:
> renato.pontefice@gmail.com writes:
>
> > As I told you before, your code works great. The only things I find that seems not work is:
>
> >
>
> > - when inside the file, there is no error text (\lojkklj\òlllò...)
>
> > the cursor, stop him self, at every occurence of [- and I have to press C-M c to reach the end of file.
>
> >
>
> > It could be a good things, that, if there is not any occurence of the error, it arrive at end of file
>
>
>
> I guess I misunderstood know what constitutes an error. Could you
>
> provide examples where the code below stops and shouldn't ?
>
>
>
> (while (and (not (eobp)) (search-forward "[-" nil t))
>
> (skip-chars-forward "A-Z")
>
> (unless (looking-at "-]")
>
> (message "Problem found, please fix and hit C-M-c to continue")
>
> (recursive-edit)))
>
>
>
> --
>
> Nicolas Richard
Ok, this file (is an example) has not problem, but when I execute the code, it arrive at the end of file but do not show that is arrived at the endo of file
TIA
Renato
ps
(I send you the file at you email, because I'm unable to send here a file )
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-04 10:48 ` Renato Pontefice
@ 2014-09-05 12:02 ` Nicolas Richard
[not found] ` <mailman.8325.1409918483.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 23+ messages in thread
From: Nicolas Richard @ 2014-09-05 12:02 UTC (permalink / raw)
To: Renato Pontefice; +Cc: help-gnu-emacs
Renato Pontefice <renato.pontefice@gmail.com> writes:
> Ok, this file (is an example) has not problem, but when I execute the
> code, it arrive at the end of file but do not show that is arrived at
> the endo of file
As I think I have said by email (I should stop using multiple inboxes, I
can never remember if I did send my answers), here's a snippet which
should do what you want :
(while (and (not (eobp))
(search-forward "[-" nil 'move)))
(skip-chars-forward "A-Z")
(unless (looking-at "-]")
(message "Problem found, please fix and hit C-M-c to continue")
(recursive-edit))
i.e. I switched to a non-boolean ('move) NOERROR argument to
search-forward.
HTH,
--
Nicolas Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <mailman.8325.1409918483.1147.help-gnu-emacs@gnu.org>
@ 2014-09-10 8:55 ` Renato Pontefice
2014-09-10 10:01 ` Nicolas Richard
[not found] ` <mailman.8606.1410343132.1147.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 23+ messages in thread
From: Renato Pontefice @ 2014-09-10 8:55 UTC (permalink / raw)
To: help-gnu-emacs
Il giorno venerdì 5 settembre 2014 14:02:33 UTC+2, Nicolas Richard ha scritto:
> Renato Pontefice <renato.pontefice@gmail.com> writes:
>
> > Ok, this file (is an example) has not problem, but when I execute the
>
> > code, it arrive at the end of file but do not show that is arrived at
>
> > the endo of file
>
>
>
> As I think I have said by email (I should stop using multiple inboxes, I
>
> can never remember if I did send my answers), here's a snippet which
>
> should do what you want :
>
>
>
> (while (and (not (eobp))
>
> (search-forward "[-" nil 'move)))
>
> (skip-chars-forward "A-Z")
>
> (unless (looking-at "-]")
>
> (message "Problem found, please fix and hit C-M-c to continue")
>
> (recursive-edit))
>
>
>
> i.e. I switched to a non-boolean ('move) NOERROR argument to
>
> search-forward.
>
>
>
> HTH,
>
>
>
> --
>
> Nicolas Richard
Hi Nicolas,
sorry for the delay, these days I have been involved.
this code:
>(while (and (not (eobp))
>
> (search-forward "[-" nil 'move)))
>
> (skip-chars-forward "A-Z")
>
> (unless (looking-at "-]")
>
> (message "Problem found, please fix and hit C-M-c to continue")
>
> (recursive-edit))
doesn't works :-(
it seems like it does not start search.
what is changed?
TIA
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-10 8:55 ` Renato Pontefice
@ 2014-09-10 10:01 ` Nicolas Richard
[not found] ` <mailman.8606.1410343132.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 23+ messages in thread
From: Nicolas Richard @ 2014-09-10 10:01 UTC (permalink / raw)
To: Renato Pontefice; +Cc: help-gnu-emacs
Renato Pontefice <renato.pontefice@gmail.com> writes:
>>(while (and (not (eobp))
>>
>> (search-forward "[-" nil 'move)))
>>
>> (skip-chars-forward "A-Z")
>>
>> (unless (looking-at "-]")
>>
>> (message "Problem found, please fix and hit C-M-c to continue")
>>
>> (recursive-edit))
>
> doesn't works :-(
>
> it seems like it does not start search.
>
> what is changed?
Did you try from the beginning of buffer ? (it only searches forward)
IIRC the only thing I changed was use a 'move argument in search-forward
(anything besides t or nil, in fact).
--
Nicolas Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <mailman.8606.1410343132.1147.help-gnu-emacs@gnu.org>
@ 2014-09-10 10:20 ` Renato Pontefice
2014-09-10 13:52 ` Nicolas Richard
[not found] ` <mailman.8618.1410357057.1147.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 23+ messages in thread
From: Renato Pontefice @ 2014-09-10 10:20 UTC (permalink / raw)
To: help-gnu-emacs
Il giorno mercoledì 10 settembre 2014 12:01:07 UTC+2, Nicolas Richard ha scritto:
> Renato Pontefice <renato.pontefice@gmail.com> writes:
>
> >>(while (and (not (eobp))
>
> >>
>
> >> (search-forward "[-" nil 'move)))
>
> >>
>
> >> (skip-chars-forward "A-Z")
>
> >>
>
> >> (unless (looking-at "-]")
>
> >>
>
> >> (message "Problem found, please fix and hit C-M-c to continue")
>
> >>
>
> >> (recursive-edit))
>
> >
>
> > doesn't works :-(
>
> >
>
> > it seems like it does not start search.
>
> >
>
> > what is changed?
>
>
>
> Did you try from the beginning of buffer ? (it only searches forward)
>
> IIRC the only thing I changed was use a 'move argument in search-forward
>
> (anything besides t or nil, in fact).
>
>
>
> --
>
> Nicolas Richard
Yes. From the beginning! it give me:
trailing garbage following expression
in that line: " (search-forward "[-" nil 'move)))"
do the ' character is correct?
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
2014-09-10 10:20 ` Renato Pontefice
@ 2014-09-10 13:52 ` Nicolas Richard
[not found] ` <mailman.8618.1410357057.1147.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 23+ messages in thread
From: Nicolas Richard @ 2014-09-10 13:52 UTC (permalink / raw)
To: Renato Pontefice; +Cc: help-gnu-emacs
Hello Renato,
Renato Pontefice <renato.pontefice@gmail.com> writes:
> Yes. From the beginning! it give me:
> trailing garbage following expression
>
> in that line: " (search-forward "[-" nil 'move)))"
>
> do the ' character is correct?
It is. There is however one paren that should be else where. I guess I
copy-pasted too hastily. Here's a corrected version:
(while (and (not (eobp))
(search-forward "[-" nil 'move))
(skip-chars-forward "A-Z")
(unless (looking-at "-]")
(message "Problem found, please fix and hit C-M-c to continue")
(recursive-edit)))
--
Nicolas Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: regexp on emacs how to...
[not found] ` <mailman.8618.1410357057.1147.help-gnu-emacs@gnu.org>
@ 2014-09-11 7:29 ` Renato Pontefice
0 siblings, 0 replies; 23+ messages in thread
From: Renato Pontefice @ 2014-09-11 7:29 UTC (permalink / raw)
To: help-gnu-emacs
Il giorno mercoledì 10 settembre 2014 15:52:53 UTC+2, Nicolas Richard ha scritto:
> Hello Renato,
>
>
>
> Renato Pontefice <renato.pontefice@gmail.com> writes:
>
> > Yes. From the beginning! it give me:
>
> > trailing garbage following expression
>
> >
>
> > in that line: " (search-forward "[-" nil 'move)))"
>
> >
>
> > do the ' character is correct?
>
>
>
> It is. There is however one paren that should be else where. I guess I
>
> copy-pasted too hastily. Here's a corrected version:
>
>
>
> (while (and (not (eobp))
>
> (search-forward "[-" nil 'move))
>
> (skip-chars-forward "A-Z")
>
> (unless (looking-at "-]")
>
> (message "Problem found, please fix and hit C-M-c to continue")
>
> (recursive-edit)))
>
>
>
> --
>
> Nicolas Richard
Hi Nicolas,
yes...it works...:-(
I see the ' char and I don't see the third parenthesis...:-(
Thank you
Renato
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2014-09-11 7:29 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-30 21:01 regexp on emacs how to renato.pontefice
2014-08-30 22:17 ` Thorsten Jolitz
2014-08-30 22:39 ` Thorsten Jolitz
[not found] ` <mailman.7955.1409438369.1147.help-gnu-emacs@gnu.org>
2014-09-01 8:15 ` renato.pontefice
2014-09-01 8:24 ` Eric Abrahamsen
2014-09-01 9:14 ` Thorsten Jolitz
2014-09-01 9:10 ` Thorsten Jolitz
[not found] ` <mailman.8023.1409562921.1147.help-gnu-emacs@gnu.org>
2014-09-01 10:11 ` renato.pontefice
2014-09-01 10:28 ` Thorsten Jolitz
2014-09-01 10:38 ` Álvar Ibeas
2014-09-01 9:56 ` Nicolas Richard
[not found] ` <CAF83ECB74PD7An-scqk74gN4YzrGC9DW8at1-cCFzV1utYSFRQ@mail.gmail.com>
2014-09-02 10:53 ` Nicolas Richard
[not found] ` <874mwrrudt.fsf@yahoo.fr>
[not found] ` <CAF83ECB2NbV0QdCbd0H8Z-PJB0ZbYboswpjFudc__9JQH+P=1Q@mail.gmail.com>
2014-09-02 11:03 ` Nicolas Richard
[not found] ` <mailman.8096.1409655669.1147.help-gnu-emacs@gnu.org>
2014-09-03 9:24 ` renato.pontefice
2014-09-03 9:25 ` renato.pontefice
2014-09-03 10:47 ` Nicolas Richard
[not found] ` <mailman.8184.1409741111.1147.help-gnu-emacs@gnu.org>
2014-09-04 10:48 ` Renato Pontefice
2014-09-05 12:02 ` Nicolas Richard
[not found] ` <mailman.8325.1409918483.1147.help-gnu-emacs@gnu.org>
2014-09-10 8:55 ` Renato Pontefice
2014-09-10 10:01 ` Nicolas Richard
[not found] ` <mailman.8606.1410343132.1147.help-gnu-emacs@gnu.org>
2014-09-10 10:20 ` Renato Pontefice
2014-09-10 13:52 ` Nicolas Richard
[not found] ` <mailman.8618.1410357057.1147.help-gnu-emacs@gnu.org>
2014-09-11 7:29 ` Renato Pontefice
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).