unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* PCL-CVS: M-x cvs-update vs. key binding in *cvs* buffer
@ 2007-08-20 19:22 Reiner Steib
  2007-08-21 15:22 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Reiner Steib @ 2007-08-20 19:22 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

Hi,

`M-x cvs-update RET' prompts for a directory and creates a *cvs*
buffer.  Do `M-x cvs-update RET' in the *cvs* buffer.  Again, it
prompts for a directory.

Now eval (global-set-key (kbd "C-c v u") 'cvs-update).  Then, when
pressing `C-c v u' in the *cvs* buffer, it won't ask for a directory.

I'd expect `cvs-update' to behave the same, no matter how it is called
(M-x vs. key binding).

It seems that `cvs-query-directory' tries to figure out if it was
called via M-x.  But I don't quite understand the purpose.

--8<---------------cut here---------------start------------->8---
(defun cvs-query-directory (msg)
  ;; last-command-char = ?\r hints that the command was run via M-x
  (if (and (cvs-buffer-p)

	   (not current-prefix-arg)
	   (not (eq last-command-char ?\r)))
      default-directory
    (read-directory-name msg nil default-directory nil)))
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: PCL-CVS: M-x cvs-update vs. key binding in *cvs* buffer
  2007-08-20 19:22 PCL-CVS: M-x cvs-update vs. key binding in *cvs* buffer Reiner Steib
@ 2007-08-21 15:22 ` Stefan Monnier
  2007-08-22 20:07   ` Reiner Steib
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2007-08-21 15:22 UTC (permalink / raw)
  To: emacs-devel

> It seems that `cvs-query-directory' tries to figure out if it was
> called via M-x.  But I don't quite understand the purpose.

I can't remember the original reason.  It may have been to preserve the
original behavior which was to always prompt for a directory.
But since C-u does the job as well we don't need that kind of hack.
Feel free to remove it,


        Stefan

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

* Re: PCL-CVS: M-x cvs-update vs. key binding in *cvs* buffer
  2007-08-21 15:22 ` Stefan Monnier
@ 2007-08-22 20:07   ` Reiner Steib
  2007-08-22 20:29     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Reiner Steib @ 2007-08-22 20:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Tue, Aug 21 2007, Stefan Monnier wrote:

>> It seems that `cvs-query-directory' tries to figure out if it was
>> called via M-x.  But I don't quite understand the purpose.
>
> I can't remember the original reason.  It may have been to preserve the
> original behavior which was to always prompt for a directory.
> But since C-u does the job as well we don't need that kind of hack.
> Feel free to remove it,

Like this (maybe someone could suggest a nicer doc string)?
Should it go to go to Emacs 22.2 as well?

--8<---------------cut here---------------start------------->8---
(defun cvs-query-directory (prompt)
  "Read directory name, prompting with PROMPT.
If in a *cvs* buffer, don't prompt unless a prefix argument is given."
  (if (and (cvs-buffer-p)
	   (not current-prefix-arg))
      default-directory
    (read-directory-name prompt nil default-directory nil)))
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
--- pcvs.el	12 Aug 2007 18:07:07 -0000	1.98.2.7
+++ pcvs.el	22 Aug 2007 20:01:16 -0000
@@ -981,13 +981,13 @@
   (interactive)
   (cvs-examine default-directory t))
 
-(defun cvs-query-directory (msg)
-  ;; last-command-char = ?\r hints that the command was run via M-x
+(defun cvs-query-directory (prompt)
+  "Read directory name, prompting with PROMPT.
+If in a *cvs* buffer, don't prompt unless a prefix argument is given."
   (if (and (cvs-buffer-p)
-	   (not current-prefix-arg)
-	   (not (eq last-command-char ?\r)))
+	   (not current-prefix-arg))
       default-directory
-    (read-directory-name msg nil default-directory nil)))
+    (read-directory-name prompt nil default-directory nil)))
 
 ;;;###autoload
 (defun cvs-quickdir (dir &optional flags noshow)
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: PCL-CVS: M-x cvs-update vs. key binding in *cvs* buffer
  2007-08-22 20:07   ` Reiner Steib
@ 2007-08-22 20:29     ` Stefan Monnier
  2007-08-25 12:27       ` Reiner Steib
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2007-08-22 20:29 UTC (permalink / raw)
  To: emacs-devel

> Like this (maybe someone could suggest a nicer doc string)?

Looks good, yes.

> Should it go to go to Emacs 22.2 as well?

I have no opinion on that.


        Stefan

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

* Re: PCL-CVS: M-x cvs-update vs. key binding in *cvs* buffer
  2007-08-22 20:29     ` Stefan Monnier
@ 2007-08-25 12:27       ` Reiner Steib
  0 siblings, 0 replies; 5+ messages in thread
From: Reiner Steib @ 2007-08-25 12:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Wed, Aug 22 2007, Stefan Monnier wrote:

>> Like this (maybe someone could suggest a nicer doc string)?
>
> Looks good, yes.
>
>> Should it go to go to Emacs 22.2 as well?
>
> I have no opinion on that.

Installed on EMACS_22_BASE and TRUNK.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

end of thread, other threads:[~2007-08-25 12:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-20 19:22 PCL-CVS: M-x cvs-update vs. key binding in *cvs* buffer Reiner Steib
2007-08-21 15:22 ` Stefan Monnier
2007-08-22 20:07   ` Reiner Steib
2007-08-22 20:29     ` Stefan Monnier
2007-08-25 12:27       ` Reiner Steib

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