summaryrefslogtreecommitdiff
path: root/pancake.el
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-14 18:26:15 +0300
committerdefanor <defanor@uberspace.net>2017-12-14 18:26:15 +0300
commite1151532a46a7ce2c59a8bc86088063cb03c4438 (patch)
tree77d7be9e4a0f0c6f8194893b376b23ed2dcdc89f /pancake.el
parent1caba09338025f92e3dc059efe009eec8d386f30 (diff)
Rename main elisp functions
`pancake' into `pancake-new', `pancake-browse-url' into `pancake', and make its URL argument optional. Should be less confusing and more idiomatic this way, similar to w3m.
Diffstat (limited to 'pancake.el')
-rw-r--r--pancake.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/pancake.el b/pancake.el
index 2cfa08b..98aab6d 100644
--- a/pancake.el
+++ b/pancake.el
@@ -110,7 +110,7 @@
(defvar pancake-buffers '()
"A list of pancake browser buffers, used to find a buffer to
- use by `pancake-browse-url'.")
+ use by the `pancake' command.")
(defvar pancake-headings '()
"A list of headings with their levels.")
@@ -133,8 +133,8 @@
(make-variable-buffer-local 'pancake-uri-history)
;;###autoload
-(defun pancake ()
- "Run the pancake browser."
+(defun pancake-new ()
+ "Run a new pancake session."
(interactive)
(let ((p-buf (generate-new-buffer "*pancake*")))
(display-buffer p-buf)
@@ -163,16 +163,19 @@
(read-only-mode 1))))
;;###autoload
-(defun pancake-browse-url (url &optional new-session)
+(defun pancake (&optional url new-session)
"Browse an URL with pancake, suitable for setting as
-`browse-url-browser-function'."
+`browse-url-browser-function'. Or simply display a pancake buffer
+if no URL is provided."
+ (interactive)
(when (or new-session (not (consp pancake-buffers)))
- (pancake))
+ (pancake-new))
(let ((buffer (if (eq major-mode 'pancake-mode)
(current-buffer)
(car pancake-buffers))))
(with-current-buffer buffer
- (process-send-string pancake-process (concat url "\n"))
+ (when url
+ (process-send-string pancake-process (concat url "\n")))
(display-buffer (current-buffer)))))
(defun pancake-translate-color (name attr)