all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.
       [not found] <E1UqwLj-0000Jr-EW@vcs.savannah.gnu.org>
@ 2013-06-24  3:19 ` Stefan Monnier
  2013-06-24  4:17   ` Leo Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-06-24  3:19 UTC (permalink / raw)
  To: Leo Liu; +Cc: emacs-devel

> +	 ((if (memq system-type '(windows-nt ms-dos))
> +	      (string-match "\\`[a-zA-Z]:\\|[\\][^\\]" ido-selected)
> +	    (string-match "/[^/]" ido-selected))

Aka

   	 ((string-match (if (memq system-type '(windows-nt ms-dos))
   	                    "\\`[a-zA-Z]:\\|[\\][^\\]"
   	                  "/[^/]")
                        ido-selected)

-- Stefan



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

* Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.
  2013-06-24  3:19 ` [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620 Stefan Monnier
@ 2013-06-24  4:17   ` Leo Liu
  2013-06-24 12:02     ` Juanma Barranquero
  2013-06-24 16:09     ` [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620 Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Leo Liu @ 2013-06-24  4:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 2013-06-24 11:19 +0800, Stefan Monnier wrote:
> Aka
>
>    	 ((string-match (if (memq system-type '(windows-nt ms-dos))
>    	                    "\\`[a-zA-Z]:\\|[\\][^\\]"
>    	                  "/[^/]")
>                         ido-selected)
>
> -- Stefan

Fixed.

Leo



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

* Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.
  2013-06-24  4:17   ` Leo Liu
@ 2013-06-24 12:02     ` Juanma Barranquero
  2013-06-24 16:12       ` string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.] Glenn Morris
  2013-06-24 16:09     ` [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620 Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2013-06-24 12:02 UTC (permalink / raw)
  To: Leo Liu; +Cc: Stefan Monnier, Emacs developers

On Mon, Jun 24, 2013 at 6:17 AM, Leo Liu <sdl.web@gmail.com> wrote:

>>        ((string-match (if (memq system-type '(windows-nt ms-dos))
>>                           "\\`[a-zA-Z]:\\|[\\][^\\]"
>>                         "/[^/]")
>>                         ido-selected)

Aka   ((string-match-p ...)) as it is used as a predicate, and not to
extract match data.

   J



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

* Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.
  2013-06-24  4:17   ` Leo Liu
  2013-06-24 12:02     ` Juanma Barranquero
@ 2013-06-24 16:09     ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2013-06-24 16:09 UTC (permalink / raw)
  To: Leo Liu; +Cc: monnier, emacs-devel

> From: Leo Liu <sdl.web@gmail.com>
> Date: Mon, 24 Jun 2013 12:17:50 +0800
> Cc: emacs-devel@gnu.org
> 
> On 2013-06-24 11:19 +0800, Stefan Monnier wrote:
> > Aka
> >
> >    	 ((string-match (if (memq system-type '(windows-nt ms-dos))
> >    	                    "\\`[a-zA-Z]:\\|[\\][^\\]"
> >    	                  "/[^/]")
> >                         ido-selected)
> >
> > -- Stefan
> 
> Fixed.

Why doesn't this support forward slashes on DOS/Windows?  It should.



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

* string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.]
  2013-06-24 12:02     ` Juanma Barranquero
@ 2013-06-24 16:12       ` Glenn Morris
  2013-06-24 16:16         ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2013-06-24 16:12 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Emacs developers

Juanma Barranquero wrote:

> Aka   ((string-match-p ...)) as it is used as a predicate, and not to
> extract match data.

If I don't care about the match data one way or the other (as here, I
assume) why is string-match-p preferable? Is it faster or something?



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

* Re: string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.]
  2013-06-24 16:12       ` string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.] Glenn Morris
@ 2013-06-24 16:16         ` Juanma Barranquero
  2013-06-25  1:30           ` Leo Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2013-06-24 16:16 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Emacs developers

On Mon, Jun 24, 2013 at 6:12 PM, Glenn Morris <rgm@gnu.org> wrote:

> If I don't care about the match data one way or the other (as here, I
> assume) why is string-match-p preferable? Is it faster or something?

If we consider (as we do) that save-match-data is expensive enough
that we only do when necessary, I'd assume not registering the match
data is faster than registering it, yes.

But anyway, the main reason is legibility. If you encounter
string-match-p or looking-at-p you can be confident that they are
being used as predicates and the following code does not depend on the
match data. That is a net gain IMO.

   J



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

* Re: string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.]
  2013-06-24 16:16         ` Juanma Barranquero
@ 2013-06-25  1:30           ` Leo Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Leo Liu @ 2013-06-25  1:30 UTC (permalink / raw)
  To: emacs-devel

On 2013-06-25 00:16 +0800, Juanma Barranquero wrote:
> But anyway, the main reason is legibility. If you encounter
> string-match-p or looking-at-p you can be confident that they are
> being used as predicates and the following code does not depend on the
> match data. That is a net gain IMO.

I agree but since ido.el is written without this in mind I will leave it
as is to be consistent with adjacent code.

Leo




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

end of thread, other threads:[~2013-06-25  1:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1UqwLj-0000Jr-EW@vcs.savannah.gnu.org>
2013-06-24  3:19 ` [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620 Stefan Monnier
2013-06-24  4:17   ` Leo Liu
2013-06-24 12:02     ` Juanma Barranquero
2013-06-24 16:12       ` string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.] Glenn Morris
2013-06-24 16:16         ` Juanma Barranquero
2013-06-25  1:30           ` Leo Liu
2013-06-24 16:09     ` [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620 Eli Zaretskii

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.