summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-15 17:17:57 +0300
committerdefanor <defanor@uberspace.net>2017-12-15 17:50:38 +0300
commitbe0fce32fc99b26a3ae4e208fb2a244f441f3212 (patch)
tree1687c19c627610ef096efb40c27f5746b64bf9bc
parenta6c75aeb7ab8a7a9879aa5b1e17ffec4c18d446a (diff)
downloadpancake-be0fce32fc99b26a3ae4e208fb2a244f441f3212.zip
pancake-be0fce32fc99b26a3ae4e208fb2a244f441f3212.tar.gz
pancake-be0fce32fc99b26a3ae4e208fb2a244f441f3212.tar.bz2
Add the "redisplay" command
-rw-r--r--Pancake.hs6
-rw-r--r--Pancake/Command.hs2
-rw-r--r--README1
-rw-r--r--pancake.12
-rw-r--r--pancake.el5
5 files changed, 16 insertions, 0 deletions
diff --git a/Pancake.hs b/Pancake.hs
index 5d49b1a..e854d13 100644
--- a/Pancake.hs
+++ b/Pancake.hs
@@ -317,6 +317,12 @@ command Quit = liftIO $ do
command Interrupt =
putErrLn "Received SIGINT. Interrupt twice in a row to quit."
command (SetWidth w) = modify $ \s -> s { columns = w }
+command Redisplay = do
+ st <- get
+ case history st of
+ ((uri, doc):_, _) -> printDoc uri doc
+ _ -> putErrLn "There's nothing to redisplay"
+
-- | Reads commands, runs them.
eventLoop :: MonadIO m => StateT LoopState m ()
diff --git a/Pancake/Command.hs b/Pancake/Command.hs
index 5126146..4c34a19 100644
--- a/Pancake/Command.hs
+++ b/Pancake/Command.hs
@@ -61,6 +61,7 @@ data Command = Quit
| Shortcut String String
| ReloadConfig
| SetWidth (Maybe Int)
+ | Redisplay
deriving (Show, Eq)
-- | Parses a user command.
@@ -77,6 +78,7 @@ basicCommand = choice . map (\(s, c) -> try (string s <* eof) *> pure c) $
, ("reload config", ReloadConfig)
, ("help", Help)
, ("?", ShowCurrent)
+ , ("redisplay", Redisplay)
, ("", More)]
-- | Link number parser.
diff --git a/README b/README
index 7cabedf..5105c09 100644
--- a/README
+++ b/README
@@ -74,6 +74,7 @@ Commands
:<shortcut> <query>: run a query using a shortcut defined in the
configuration (e.g., search)
:set width[ <columns>]: set terminal/window width manually
+:redisplay: redisplay current document
pancake-mode provides additional aliases and commands, see built-in
emacs documentation (``C-h m``) for those.
diff --git a/pancake.1 b/pancake.1
index f5daeaf..3467e09 100644
--- a/pancake.1
+++ b/pancake.1
@@ -59,6 +59,8 @@ run a query using a shortcut defined in the configuration (e.g.,
search)
.IP "\fBset width\fR[ \fIcolumns\fR]"
set terminal/window width manually
+.IP "\fBredisplay\fR"
+redisplay current document
.SH DEFAULT SHORTCUTS
.IP "\fBg\fR"
diff --git a/pancake.el b/pancake.el
index 52021cf..c799eef 100644
--- a/pancake.el
+++ b/pancake.el
@@ -403,6 +403,11 @@ use. Current window width is used if none is provided."
(interactive)
(pancake-process-send ","))
+(defun pancake-redisplay ()
+ "Redisplay the current document."
+ (interactive)
+ (pancake-process-send "redisplay"))
+
(defun pancake-display-current-uri ()
"Display current URI and put it into the kill ring."
(interactive)