Function: bib-highlight-mouse

bib-highlight-mouse is an interactive and byte-compiled function defined in bib-cite.el.

Signature

(bib-highlight-mouse)

Documentation

Make that nice green highlight when the mouse is over LaTeX commands.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/bib-cite.el
(defun bib-highlight-mouse ()
  "Make that nice green highlight when the mouse is over LaTeX commands."
  (interactive)
  ;;Comment this out.  User should be able to use bib-highlight-mouse
  ;;to try it out regardless of bib-highlight-mouse-t.
  ;;Check bib-highlight-mouse-t only in automated cases.
  ;;
  ;;  (if (and bib-highlight-mouse-t
  ;;           ;;window-system)        ;Do nothing unless under X
  ;;           )
  ;; *all of code was here*
  ;;      )
  (save-excursion
    (let ((s)(e)
          (inhibit-read-only t)
          (modified (buffer-modified-p))) ;put-text-property changing this?
      ;; * peta Wed Nov  8 16:27:29 1995 -- better remove the mouse face
      ;;   properties first.
      ;; Remove properties for regular emacs
      ;; FIXME This detroys all mouse-faces and local-maps!
      ;; FIXME Hope no other package is using them in this buffer!
      (let ((before-change-functions) (after-change-functions))
        (remove-text-properties (point-min) (point-max)
                                '(mouse-face t local-map t)))
      (goto-char (point-min))
      (while
          (re-search-forward
           (concat
            "\\\\\\(" (substring bib-ref-regexp 2)
            "\\|label\\|[A-Za-z]*cite[A-Za-z]*\\(\\[[^]]*\\]\\)*\\){[^}]*}")
           nil t)
        (setq s (match-beginning 0))
        (setq e (match-end 0))
        (let ((before-change-functions) (after-change-functions)
              ;;(this-overlay (make-overlay s e))
              )
;;;  Even using overlays doesn't help here.  If bib-highlight-mouse-keymap
;;;  does not include the AucTeX menus, then these disappear when we click
;;;  onto a \cite command.  Perhaps using bib-cite as a minor mode will fix
;;;  this?  For now, bib-cite must be loaded after these menus are built.
;;;  It must therefore be loaded in a mode-hook.
          (put-text-property s e 'local-map bib-highlight-mouse-keymap)
          (put-text-property s e 'mouse-face 'highlight)
          ;;(overlay-put this-overlay 'local-map bib-highlight-mouse-keymap)
          ;;(overlay-put this-overlay 'mouse-face 'highlight)
          ))
      (set-buffer-modified-p modified))))