Function: ruler-mode-mouse-set-left-margin

ruler-mode-mouse-set-left-margin is an interactive and byte-compiled function defined in ruler-mode.el.gz.

Signature

(ruler-mode-mouse-set-left-margin START-EVENT)

Documentation

Set left margin end 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-set-left-margin (start-event)
  "Set left margin end to the graduation where the mouse pointer is on.
START-EVENT is the mouse click event."
  (interactive "e")
  (let* ((start (event-start start-event))
         (end   (event-end   start-event))
         col w lm rm)
    (when (eq start end) ;; mouse click
      (save-selected-window
        (select-window (posn-window start))
        (setq col (- (car (posn-col-row start))
                     (scroll-bar-columns 'left))
              w   (- (ruler-mode-full-window-width)
                     (scroll-bar-columns 'left)
                     (scroll-bar-columns 'right)))
        (when (and (>= col 0) (< col w))
          (setq lm (window-margins)
                rm (or (cdr lm) 0)
                lm (or (car lm) 0))
          (message "Left margin set to %d (was %d)" col lm)
          (set-window-margins nil col rm))))))