           "%p"
           'local-map my-mode-line-buffer-percentage-mode-map
           'mouse-face 'mode-line-highlight
-          'help-echo "mouse-1: scroll up\nCtrl mouse-1: scroll down
-Shift mouse-1: toggle between Beginning & End of buffer"))
+          'help-echo "mouse-1: scroll up\nShift mouse-1: scroll down
+Ctrl mouse-1: toggle between Beginning & End of buffer"))
     (line-number-mode
      ((column-number-mode
        (10 ,(propertize

(make-variable-buffer-local 'mode-line-position)


(defun my-mode-line-window-split-right (event)
  (interactive "e")
  (with-selected-window (posn-window (event-start event))
    (split-window-right)))

(defun my-mode-line-window-split-below (event)
  (interactive "e")
  (with-selected-window (posn-window (event-start event))
    (split-window-below)))

(defun my-mode-line-window-delete (event)
  (interactive "e")
  (with-selected-window (posn-window (event-start event))
    (delete-window)))

(defun my-mode-line-window-delete-other-windows (event)
  (interactive "e")
  (with-selected-window (posn-window (event-start event))
    (delete-other-windows)))

(defun my-make-mode-line-mouse-map (&rest args)
  (let ((map (make-sparse-keymap)))

                            mouse-face mode-line-highlight
                            local-map ,my-mode-line-buffer-modified-p-keymap))

(def-with-selected-window my-mode-line-beginning-or-end-of-buffer
  (if (bobp)
      (goto-char (point-max))
    (goto-char (point-min))))

(def-with-selected-window my-mode-line-scroll-up
  (scroll-up))

(def-with-selected-window my-mode-line-scroll-down
  (scroll-down))

(setq my-mode-line-buffer-percentage-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map [mode-line mouse-1] 'my-mode-line-scroll-up)
    (define-key map [mode-line S-mouse-1] 'my-mode-line-scroll-down)
    (define-key map [mode-line C-mouse-1] 'my-mode-line-beginning-or-end-of-buffer)
    (define-key map [mode-line down-mouse-1] 'ignore)
    map))

(def-with-selected-window my-mode-line-goto-line
  (let ((n (read-number "Goto line: ")))
    (goto-line n)))

(setq my-mode-line-column-line-number-mode-map
      (let ((map (make-sparse-keymap)))
