From 39149cc8566de4e64617c0546c80509e93165d03 Mon Sep 17 00:00:00 2001 From: defanor Date: Sun, 31 Dec 2017 10:51:17 +0300 Subject: Open links in a new session on C-u RET --- pancake.el | 14 ++++++++++---- 1 file 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." -- cgit v1.2.3