all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* calling interactive functions programmatically
@ 2003-04-25 13:27 Phillip Lord
  2003-04-25 15:38 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Phillip Lord @ 2003-04-25 13:27 UTC (permalink / raw)





Is there a way to call an interactive function, but to specify some of
the arguments programmatically?

For instance, take "find-dired". It is defined like so....

(defun find-dired (dir args)  
        (interactive (list (read-file-name "Run find in directory: " nil "" t)
                     (read-string "Run find (with args): " find-args
				  '(find-args-history . 1))))



Now I want to wrap this call inside another, where I already know the
directory in question, but do not know the arguments. 

So I guess I can do...


(defun my-find-dired(args)
    (interactive (read-string "Run find (with args): " find-args
				  '(find-args-history . 1)))
    (find-dired (get-the-directory-name-from-somewhere-else)
        args))

But ideally I would like to not do the "read-string" form, as this
duplicates everything in find-dired. 

Is there a way to do this? 

Cheers

Phil

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

* Re: calling interactive functions programmatically
  2003-04-25 13:27 calling interactive functions programmatically Phillip Lord
@ 2003-04-25 15:38 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2003-04-25 15:38 UTC (permalink / raw)


Phillip Lord wrote:

> Now I want to wrap this call inside another, where I already know the
> directory in question, but do not know the arguments. 
> 
> So I guess I can do...
> 
> 
> (defun my-find-dired(args)
>     (interactive (read-string "Run find (with args): " find-args
> 				  '(find-args-history . 1)))
>     (find-dired (get-the-directory-name-from-somewhere-else)
>         args))
> 
> But ideally I would like to not do the "read-string" form, as this
> duplicates everything in find-dired. 
> 
> Is there a way to do this? 


Does this work:

;; M-x gross-hack
(let ((unread-command-events
       (listify-key-sequence
	(concat (get-the-directory-name-from-somewhere-else)
		"\r"))))
  (call-interactively 'find-dired))


-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2003-04-25 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-25 13:27 calling interactive functions programmatically Phillip Lord
2003-04-25 15:38 ` 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.