summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-31 10:51:17 +0300
committerdefanor <defanor@uberspace.net>2017-12-31 10:51:17 +0300
commit39149cc8566de4e64617c0546c80509e93165d03 (patch)
tree0640464994acd328f2d9991181a7e0b57fa91ae2
parent0d4303a888fc8da52d6d9f92ae8748dd5b6b865f (diff)
Open links in a new session on C-u RET
-rw-r--r--pancake.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/pancake.el b/pancake.el
index 9ebf369..4b9cc7f 100644
--- a/pancake.el
+++ b/pancake.el
@@ -212,11 +212,17 @@ kill ring when called interactively."
uri))
(defun pancake-button-action (button)
- "An action to be invoked on button activation."
+ "An action to be invoked on button activation: follows
+#fragment links in pancake, opens other links with `browse-url',
+and in a new session if `current-prefix-arg' is non-nil."
(let ((pancake-uri (button-get button 'pancake-link)))
- (if (and pancake-uri (string-prefix-p "#" pancake-uri))
- (pancake pancake-uri)
- (funcall 'browse-url (button-get button 'pancake-absolute-uri)))))
+ (if (and pancake-uri
+ (string-prefix-p "#" pancake-uri)
+ (not current-prefix-arg))
+ (pancake pancake-uri)
+ (funcall 'browse-url
+ (button-get button 'pancake-absolute-uri)
+ current-prefix-arg))))
(defun pancake-print-elem (element)
"Translate ELEMENT into a string."