mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-11 10:12:15 -07:00
X.P.OrgMode: Allow specifying home dir starting with ~
It is already possible to "start" from $HOME by specifying a relative directory (one starting without a starting slash). However, it is often nice to be explicit about this by writing `~/' directly—support this.
This commit is contained in:
@@ -80,6 +80,7 @@ prepended with @$HOME@ or an equivalent directory. I.e. instead of the
|
|||||||
above you can write
|
above you can write
|
||||||
|
|
||||||
> , ("M-C-o", orgPrompt def "TODO" "org/todos.org")
|
> , ("M-C-o", orgPrompt def "TODO" "org/todos.org")
|
||||||
|
> -- also possible: "~/org/todos.org"
|
||||||
|
|
||||||
There is also some scheduling and deadline functionality present. This
|
There is also some scheduling and deadline functionality present. This
|
||||||
may be initiated by entering @+s@ or @+d@—separated by at least one
|
may be initiated by entering @+s@ or @+d@—separated by at least one
|
||||||
@@ -214,9 +215,10 @@ mkOrgPrompt xpc oc@OrgMode{ todoHeader, orgFile, clpSupport } =
|
|||||||
then Header sel
|
then Header sel
|
||||||
else Body $ "\n " <> sel
|
else Body $ "\n " <> sel
|
||||||
|
|
||||||
-- Expand relative path with $HOME
|
-- Expand path if applicable
|
||||||
fp <- case orgFile of
|
fp <- case orgFile of
|
||||||
'/' : _ -> pure orgFile
|
'/' : _ -> pure orgFile
|
||||||
|
'~' : '/' : _ -> getHomeDirectory <&> (<> drop 1 orgFile)
|
||||||
_ -> getHomeDirectory <&> (<> ('/' : orgFile))
|
_ -> getHomeDirectory <&> (<> ('/' : orgFile))
|
||||||
|
|
||||||
withFile fp AppendMode . flip hPutStrLn
|
withFile fp AppendMode . flip hPutStrLn
|
||||||
|
Reference in New Issue
Block a user