unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* shell escape function
@ 2021-02-27 11:51 Tomas Hlavaty
  2021-02-27 15:25 ` Philipp
  0 siblings, 1 reply; 3+ messages in thread
From: Tomas Hlavaty @ 2021-02-27 11:51 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

in order to read graphics pdf and media on the console, I have the
following two functions:

(defun fbpdf (fname)
  (interactive "sFile name: ")
  (suspend-emacs (format "fbpdf -w '%s'; fg" (expand-file-name fname))))

(defun fbmpv (fname)
  (interactive "sFile name: ")
  (suspend-emacs (format "mpv --vo=drm '%s'; fg" (expand-file-name fname))))

I can use them as follows:

(fbpdf "~/Downloads/pdf/bad-is-stronger-than-good.pdf")
(fbmpv "~/Downloads/vid/how-complex.mkv")

Is there a function in emacs which escapes shell string, in this case
the filename?

I have not found anything so far.

Thanks in advance,

Tomas



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

* Re: shell escape function
  2021-02-27 11:51 shell escape function Tomas Hlavaty
@ 2021-02-27 15:25 ` Philipp
  2021-02-27 18:27   ` Tomas Hlavaty
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp @ 2021-02-27 15:25 UTC (permalink / raw)
  To: Tomas Hlavaty; +Cc: help-gnu-emacs



> Am 27.02.2021 um 12:51 schrieb Tomas Hlavaty <tom@logand.com>:
> 
> Hi,
> 
> in order to read graphics pdf and media on the console, I have the
> following two functions:
> 
> (defun fbpdf (fname)
>  (interactive "sFile name: ")
>  (suspend-emacs (format "fbpdf -w '%s'; fg" (expand-file-name fname))))
> 
> (defun fbmpv (fname)
>  (interactive "sFile name: ")
>  (suspend-emacs (format "mpv --vo=drm '%s'; fg" (expand-file-name fname))))
> 
> I can use them as follows:
> 
> (fbpdf "~/Downloads/pdf/bad-is-stronger-than-good.pdf")
> (fbmpv "~/Downloads/vid/how-complex.mkv")
> 
> Is there a function in emacs which escapes shell string, in this case
> the filename?

shell-quote-argument



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

* Re: shell escape function
  2021-02-27 15:25 ` Philipp
@ 2021-02-27 18:27   ` Tomas Hlavaty
  0 siblings, 0 replies; 3+ messages in thread
From: Tomas Hlavaty @ 2021-02-27 18:27 UTC (permalink / raw)
  To: Philipp; +Cc: help-gnu-emacs

On Sat 27 Feb 2021 at 16:25, Philipp <p.stephani2@gmail.com> wrote:
>> Is there a function in emacs which escapes shell string, in this case
>> the filename?
>
> shell-quote-argument

thanks a lot, that's what i was looking for



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

end of thread, other threads:[~2021-02-27 18:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-27 11:51 shell escape function Tomas Hlavaty
2021-02-27 15:25 ` Philipp
2021-02-27 18:27   ` Tomas Hlavaty

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