Sunday, June 12, 2011

Semantic-ia-fast-jump doesn't push the tag mark in Emacs

In Emacs 23.3, if you try to run pop-tag-mark after performing semantic-complete-jump, you will get the message "The tags stack is empty." The reason for this behavior is because the function push-tag-mark is not defined in etags.el. This behavior is inconsistent with the behavior of find-tag which does push the tag mark. To get around this problem, define the push-tag-mark function by adding the following code to your .emacs file.

;; Implementing my own copy of this function since it is required by
;; semantic-ia-fast-jump but this function is not defined in etags.el
;; of GNU emacs
(require 'etags)
(unless (fboundp 'push-tag-mark)
  (defun push-tag-mark ()
    "Push the current position to the ring of markers so that
    \\[pop-tag-mark] can be used to come back to current position."
    (interactive)
    (ring-insert find-tag-marker-ring (point-marker))
    )
  )

No comments: