Function: ruler-mode-mouse-add-tab-stop

ruler-mode-mouse-add-tab-stop is an interactive and byte-compiled function defined in ruler-mode.el.gz.

Signature

(ruler-mode-mouse-add-tab-stop START-EVENT)

Documentation

Add a tab stop to the graduation where the mouse pointer is on.

START-EVENT is the mouse click event.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/ruler-mode.el.gz
(defun ruler-mode-mouse-add-tab-stop (start-event)
  "Add a tab stop to the graduation where the mouse pointer is on.
START-EVENT is the mouse click event."
  (interactive "e")
  (when ruler-mode-show-tab-stops
    (let* ((start (event-start start-event))
           (end   (event-end   start-event))
           col ts)
      (when (eq start end) ;; mouse click
        (save-selected-window
          (select-window (posn-window start))
          (setq col (ruler-mode-window-col (car (posn-col-row start)))
                ts  (+ col (ruler-mode-text-scaled-window-hscroll)))
          (and (>= col 0) (< col (ruler-mode-text-scaled-window-width))
               (not (member ts tab-stop-list))
               (progn
                 (message "Tab stop set to %d" ts)
                 (when (null tab-stop-list)
                   (setq tab-stop-list (indent-accumulate-tab-stops (1- ts))))
                 (setq tab-stop-list (sort (cons ts tab-stop-list) #'<)))))))))