Function: sgml-cursor-sensor

sgml-cursor-sensor is a byte-compiled function defined in sgml-mode.el.gz.

Signature

(sgml-cursor-sensor WINDOW X DIR)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/sgml-mode.el.gz
(defun sgml-cursor-sensor (window x dir)
  ;; Show preceding or following hidden tag, depending of cursor direction (and
  ;; `dir' is not the direction in this sense).
  (when (eq dir 'entered)
    (ignore-errors
      (let* ((y (window-point window))
             (otherend
              (save-excursion
                (goto-char y)
                (cond
                 ((and (eq (char-before) ?>)
                       (or (not (eq (char-after) ?<))
                           (> x y)))
                  (sgml-forward-sexp -1))
                 ((eq (char-after y) ?<)
                  (sgml-forward-sexp 1)))
                (point))))
        (message "Invisible tag: %s"
                 ;; Strip properties, otherwise, the text is invisible.
                 (buffer-substring-no-properties
                  y otherend))))))