summaryrefslogtreecommitdiffstats
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
parent1caba09338025f92e3dc059efe009eec8d386f30 (diff)
downloadpancake-e1151532a46a7ce2c59a8bc86088063cb03c4438.zip
pancake-e1151532a46a7ce2c59a8bc86088063cb03c4438.tar.gz
pancake-e1151532a46a7ce2c59a8bc86088063cb03c4438.tar.bz2
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.
-rw-r--r--README2
-rw-r--r--pancake.el17
2 files changed, 11 insertions, 8 deletions
diff --git a/README b/README
index d6ae0d0..92d7240 100644
--- a/README
+++ b/README
@@ -43,7 +43,7 @@ Emacs interface
your default emacs browser::
(require 'pancake)
- (setq browse-url-browser-function 'pancake-browse-url)
+ (setq browse-url-browser-function 'pancake)
To load and show all images automatically (not just after saving them
manually)::
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)