* Launch application with region as a parameter @ 2014-10-06 15:33 twiki 2014-10-06 17:01 ` Alexander Baier ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: twiki @ 2014-10-06 15:33 UTC (permalink / raw) To: help-gnu-emacs I've text-buffer and the cursor is here... ... bla bla bla c:\tmp\doc1.pdf bla bla bla ^ ... I want select this line and launch (with =C-c o=) Adobe Reader (or also) on c:\tmp\doc1.pdf Suggestions? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Launch application with region as a parameter 2014-10-06 15:33 Launch application with region as a parameter twiki @ 2014-10-06 17:01 ` Alexander Baier 2014-10-06 23:35 ` Tak Kunihiro [not found] ` <mailman.10602.1412638553.1147.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 6+ messages in thread From: Alexander Baier @ 2014-10-06 17:01 UTC (permalink / raw) To: twiki; +Cc: help-gnu-emacs On 2014-10-06 17:33 twiki wrote: > I've text-buffer and the cursor is here... > > ... > > bla bla bla c:\tmp\doc1.pdf bla bla bla > ^ > ... > > I want select this line and launch (with =C-c o=) Adobe Reader (or also) > on c:\tmp\doc1.pdf You could use (thing-at-point 'filename) to get the filename and then start-process or maybe async-shell-command to start Adobe Reader. HTH, -- Alexander Baier ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Launch application with region as a parameter 2014-10-06 15:33 Launch application with region as a parameter twiki 2014-10-06 17:01 ` Alexander Baier @ 2014-10-06 23:35 ` Tak Kunihiro [not found] ` <mailman.10602.1412638553.1147.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 6+ messages in thread From: Tak Kunihiro @ 2014-10-06 23:35 UTC (permalink / raw) To: help-gnu-emacs; +Cc: tak.kunihiro I suppose you want to have something like below. (defun open-file-at-point () "Open a file at point by Explorer." (interactive) (let ((file (thing-at-point 'filename)) w32file) (when (file-exists-p file) (setq w32file (subst-char-in-string ?/ ?\\ (expand-file-name file))) (w32-shell-execute "open" "explorer" w32file)))) (global-set-key (kbd "C-c o") 'open-thing-at-point) ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.10602.1412638553.1147.help-gnu-emacs@gnu.org>]
* Re: Launch application with region as a parameter [not found] ` <mailman.10602.1412638553.1147.help-gnu-emacs@gnu.org> @ 2014-10-07 15:54 ` twiki 2014-10-07 16:28 ` Alexander Baier [not found] ` <mailman.10652.1412699323.1147.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 6+ messages in thread From: twiki @ 2014-10-07 15:54 UTC (permalink / raw) To: help-gnu-emacs Ok... thax for suggestion... i've defined launch-command-at-point... (defun launch-command-at-point() "Launch associated application for current thing-at-point string" (interactive) (async-shell-command (thing-at-point 'filename))) (global-set-key (kbd "<f11>") 'launch-command-at-point) ...but i don't know how to grab the quoted entire line: i need/want to pass the entire line to async-shell-command: ... c:\dir1\subdir a\p1.pdf ... (grace for my english!) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Launch application with region as a parameter 2014-10-07 15:54 ` twiki @ 2014-10-07 16:28 ` Alexander Baier [not found] ` <mailman.10652.1412699323.1147.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 6+ messages in thread From: Alexander Baier @ 2014-10-07 16:28 UTC (permalink / raw) To: twiki; +Cc: help-gnu-emacs On 2014-10-07 17:54 twiki wrote: > Ok... thax for suggestion... i've defined launch-command-at-point... > > (defun launch-command-at-point() > "Launch associated application for current thing-at-point string" > (interactive) > (async-shell-command (thing-at-point 'filename))) > > (global-set-key (kbd "<f11>") 'launch-command-at-point) > > > ...but i don't know how to grab the quoted entire line: i need/want to > pass the entire line to async-shell-command: > > ... > c:\dir1\subdir a\p1.pdf > ... I am not completely sure what it is that you are trying to do. If you want to get the entire line you can do (thing-at-point 'line). I don't know what you mean by "quoted". Regards, -- Alexander Baier ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.10652.1412699323.1147.help-gnu-emacs@gnu.org>]
* Re: Launch application with region as a parameter [not found] ` <mailman.10652.1412699323.1147.help-gnu-emacs@gnu.org> @ 2014-10-07 16:54 ` twiki 0 siblings, 0 replies; 6+ messages in thread From: twiki @ 2014-10-07 16:54 UTC (permalink / raw) To: help-gnu-emacs Ok... sorry for my terrible english :-( I mean the following thing... my text-file is.. ... bla bla bla bla bla bla bla bla c:\dira\subdir a\document1.pdf (*) bla bla bla bla c:\dirb\subdir b\image.jpg (**) bla bla bla ... If i've the cursor on (*)... i want open Adobe Reader on "c:\dira\subdir a\document1.pdf" and if i've the cursor on (**)... i want open my Image Viewer on "c:\dirb\subdir b\image.jpg" Thanks to the suggestions I had found the solution following: (defun quote-string-for-shell ( string ) "quote-string-for-shell STRING quote the string with \" for the shell. " (concat "\"" string "\"")) (defun launch-command-at-point() "Launch associate application for current thing-at-point string" (interactive) (w32-shell-execute "open" "explorer" (quote-string-for-shell (thing-at-point 'line)))) (global-set-key (kbd "<f11>") 'launch-command-at-point) ThanX! ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-07 16:54 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-06 15:33 Launch application with region as a parameter twiki 2014-10-06 17:01 ` Alexander Baier 2014-10-06 23:35 ` Tak Kunihiro [not found] ` <mailman.10602.1412638553.1147.help-gnu-emacs@gnu.org> 2014-10-07 15:54 ` twiki 2014-10-07 16:28 ` Alexander Baier [not found] ` <mailman.10652.1412699323.1147.help-gnu-emacs@gnu.org> 2014-10-07 16:54 ` twiki
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).