From 1456289c86bebe3c9a5ce13f722304f1291e1a6f Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Tue, 16 May 2017 14:21:27 -0400 Subject: [PATCH] Only set mark when called interactively --- markdown-mode.el | 3 ++- tests/markdown-test.el | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index 6061c99..dea4e0f 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -5592,7 +5592,8 @@ Stop at the first and last headings of a superior heading." "Move to the visible heading line of which the present line is a subheading. With argument, move up ARG levels." (interactive "p") - (or (eq last-command 'markdown-up-heading) (push-mark)) + (and (called-interactively-p 'any) + (not (eq last-command 'markdown-up-heading)) (push-mark)) (markdown-move-heading-common 'outline-up-heading arg)) (defun markdown-back-to-heading (&optional invisible-ok) diff --git a/tests/markdown-test.el b/tests/markdown-test.el index 350d66a..127777c 100644 --- a/tests/markdown-test.el +++ b/tests/markdown-test.el @@ -3204,12 +3204,12 @@ x: x (should (eq (point) 69)) (should (looking-at "^## A second-level header$")) ;; Navigate up the hierarchy (atx) - (markdown-up-heading 1) + (call-interactively #'markdown-up-heading) (should (looking-at "^# A top-level header")) (should (eq (mark) 69)) ;; Navigate up the hierarchy (setext) (goto-char 516) - (markdown-up-heading 1) + (call-interactively #'markdown-up-heading) (should (looking-at "^An underline-style header$")) (should (eq (mark) 516)))) -- 2.11.4.GIT