From 6956c17e1e7ef2899026ad365a0acdd4ce63cb80 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Mon, 15 Dec 2014 18:27:33 -0200 Subject: user-error is "not known to be defined" in emacs 24.2 --- sx-button.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sx-button.el') diff --git a/sx-button.el b/sx-button.el index dbadc2e..1727a3d 100644 --- a/sx-button.el +++ b/sx-button.el @@ -96,7 +96,7 @@ code-block." (interactive) (browse-url (or (get-text-property (or pos (point)) 'sx-button-url) - (user-error "No url under point: %s" (or pos (point)))))) + (sx-user-error "No url under point: %s" (or pos (point)))))) ;;; Help-echo definitions -- cgit v1.2.3 From 0a2f984d0771b9a921696af1fe3bad10cdbb7b54 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Mon, 15 Dec 2014 18:39:38 -0200 Subject: `sx-custom-button' fails to specify containing group --- sx-button.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sx-button.el') diff --git a/sx-button.el b/sx-button.el index 1727a3d..283fe0d 100644 --- a/sx-button.el +++ b/sx-button.el @@ -51,7 +51,8 @@ '((((type x w32 ns) (class color)) ; Like default mode line :box (:line-width 2 :style released-button) :background "lightgrey" :foreground "black")) - "Face used on buttons such as \"Write an Answer\".") + "Face used on buttons such as \"Write an Answer\"." + :group 'sx) ;;; Command definitions -- cgit v1.2.3 From 28bb9c2d582f301bb328c2ca84ad97dcbed87abb Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 16 Dec 2014 21:08:58 -0200 Subject: Activate major-mode when editing code-blocks --- sx-button.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sx-button.el') diff --git a/sx-button.el b/sx-button.el index 283fe0d..f166164 100644 --- a/sx-button.el +++ b/sx-button.el @@ -77,20 +77,23 @@ This is usually a link's URL, or the content of a code block." (point) 'sx-button-copy-type) content))))) -(defun sx-button-edit-this (text-or-marker) - "Open a temp buffer populated with the string TEXT-OR-MARKER. +(defun sx-button-edit-this (text-or-marker &optional major-mode) + "Open a temp buffer populated with the string TEXT-OR-MARKER using MAJOR-MODE. When given a marker (or interactively), use the 'sx-button-copy -text-property under the marker. This is usually the content of a -code-block." +and the 'sx-mode text-properties under the marker. These are +usually part of a code-block." (interactive (list (point-marker))) ;; Buttons receive markers. (when (markerp text-or-marker) + (setq major-mode (get-text-property text-or-marker 'sx-mode)) (unless (setq text-or-marker (get-text-property text-or-marker 'sx-button-copy)) (sx-message "Nothing of interest here."))) (with-current-buffer (pop-to-buffer (generate-new-buffer "*sx temp buffer*")) - (insert text-or-marker))) + (insert text-or-marker) + (when major-mode + (funcall major-mode)))) (defun sx-button-follow-link (&optional pos) "Follow link at POS. If POS is nil, use `point'." -- cgit v1.2.3