unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: /srv/bzr/emacs/trunk r107646: * lisp/files.el (move-file-to-trash): Files aren't regexps.
       [not found] <E1SAQ61-0002vF-Rw@vcs.savannah.gnu.org>
@ 2012-03-21 19:10 ` Glenn Morris
  2012-03-21 21:14   ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Glenn Morris @ 2012-03-21 19:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier wrote:

>  	   ;; We can't trash a parent directory of trash-directory.
> -	   (if (string-match fn trash-dir)
> +	   (if (string-prefix-p fn trash-dir)
>  	       (error "Trash directory `%s' is a subdirectory of `%s'"
>  		      trash-dir filename))

Would the recently added file-subdir-of-p be more appropriate?

Also, I'd never heard of string-prefix-p (added in 23.2). It was never
mentioned in NEWS or documented in the manual.

It also exists as vc-string-prefix-p, latex-string-prefix-p,
tex-string-prefix-p, cvs-string-prefix-p, mpc-string-prefix-p...



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

* Re: /srv/bzr/emacs/trunk r107646: * lisp/files.el (move-file-to-trash): Files aren't regexps.
  2012-03-21 19:10 ` /srv/bzr/emacs/trunk r107646: * lisp/files.el (move-file-to-trash): Files aren't regexps Glenn Morris
@ 2012-03-21 21:14   ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2012-03-21 21:14 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

>> ;; We can't trash a parent directory of trash-directory.
>> -	   (if (string-match fn trash-dir)
>> +	   (if (string-prefix-p fn trash-dir)
>> (error "Trash directory `%s' is a subdirectory of `%s'"
>> trash-dir filename))
> Would the recently added file-subdir-of-p be more appropriate?

Oh, yes, even better.

> It also exists as vc-string-prefix-p, latex-string-prefix-p,
> tex-string-prefix-p, cvs-string-prefix-p, mpc-string-prefix-p...

These should be replaced, I guess,


        Stefan



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

end of thread, other threads:[~2012-03-21 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1SAQ61-0002vF-Rw@vcs.savannah.gnu.org>
2012-03-21 19:10 ` /srv/bzr/emacs/trunk r107646: * lisp/files.el (move-file-to-trash): Files aren't regexps Glenn Morris
2012-03-21 21:14   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).