mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.U.Run: Quote string in execute and eval
Ordinarily, this should already be the case. If for some reason it is not, definitely make sure to quote the input string that we want to execute.
This commit is contained in:
parent
4a3f8eb032
commit
2ebbe57bc2
@ -11,6 +11,11 @@
|
|||||||
- Added `borderResizeNear` as a variant of `borderResize` that can
|
- Added `borderResizeNear` as a variant of `borderResize` that can
|
||||||
control how many pixels near a border resizing still works.
|
control how many pixels near a border resizing still works.
|
||||||
|
|
||||||
|
* `XMonad.Util.Run`
|
||||||
|
|
||||||
|
- It is now ensured that all arguments of `execute` and `eval` are
|
||||||
|
quoted.
|
||||||
|
|
||||||
### Other changes
|
### Other changes
|
||||||
|
|
||||||
## 0.17.1 (September 3, 2022)
|
## 0.17.1 (September 3, 2022)
|
||||||
|
@ -374,12 +374,12 @@ inTerm = asks $ mkDList . terminal . config
|
|||||||
-- For programs such as Emacs, 'eval' may be the safer option; while
|
-- For programs such as Emacs, 'eval' may be the safer option; while
|
||||||
-- @emacsclient@ supports @-e@, the @emacs@ executable itself does not.
|
-- @emacsclient@ supports @-e@, the @emacs@ executable itself does not.
|
||||||
execute :: String -> X Input
|
execute :: String -> X Input
|
||||||
execute this = pure ((" -e " <> this) <>)
|
execute this = pure ((" -e " <> tryQuote this) <>)
|
||||||
|
|
||||||
-- | Eval(uate) the argument. Current /thing/ must support a @--eval@
|
-- | Eval(uate) the argument. Current /thing/ must support a @--eval@
|
||||||
-- option.
|
-- option.
|
||||||
eval :: String -> X Input
|
eval :: String -> X Input
|
||||||
eval this = pure ((" --eval " <> this) <>)
|
eval this = pure ((" --eval " <> tryQuote this) <>)
|
||||||
|
|
||||||
-- | Use 'emacs'.
|
-- | Use 'emacs'.
|
||||||
inEmacs :: X Input
|
inEmacs :: X Input
|
||||||
@ -413,6 +413,9 @@ setXClass = pure . mkDList . (" --class " <>)
|
|||||||
termInDir :: X Input
|
termInDir :: X Input
|
||||||
termInDir = inTerm >-> inWorkingDir
|
termInDir = inTerm >-> inWorkingDir
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
-- Emacs
|
||||||
|
|
||||||
-- | Transform the given input into an elisp function; i.e., surround it
|
-- | Transform the given input into an elisp function; i.e., surround it
|
||||||
-- with parentheses.
|
-- with parentheses.
|
||||||
--
|
--
|
||||||
@ -493,3 +496,8 @@ inParens :: String -> String
|
|||||||
inParens s = case s of
|
inParens s = case s of
|
||||||
'(' : _ -> s
|
'(' : _ -> s
|
||||||
_ -> "(" <> s <> ")"
|
_ -> "(" <> s <> ")"
|
||||||
|
|
||||||
|
tryQuote :: String -> String
|
||||||
|
tryQuote s = case dropWhile (== ' ') s of
|
||||||
|
'\'' : _ -> s
|
||||||
|
_ -> "'" <> s <> "'"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user