Variable: lost-selection-mode-hook

lost-selection-mode-hook is a customizable variable defined in select.el.gz.

Value

nil

Documentation

Hook run after entering or leaving lost-selection-mode(var)/lost-selection-mode(fun).

No problems result if this variable is not bound. add-hook automatically binds it. (This is true for all hook variables.)

Source Code

;; Defined in /usr/src/emacs/lisp/select.el.gz
(define-minor-mode lost-selection-mode
  "Toggle `lost-selection-mode'.

When this is enabled, selecting some text in another program will
cause the mark to be deactivated in all buffers, mimicking the
behavior of most X Windows programs.

Selecting text in a buffer that ends up changing the primary
selection will also cause the mark to be deactivated in all other
buffers."
  :global t
  :group 'x
  (if lost-selection-mode
      (progn
        (cond ((featurep 'x) (add-hook 'x-lost-selection-functions
                                       #'lost-selection-function))
              ((featurep 'pgtk) (add-hook 'pgtk-lost-selection-functions
                                          #'lost-selection-function))
              ((featurep 'haiku) (add-hook 'haiku-lost-selection-functions
                                           #'lost-selection-function)))
        (add-hook 'post-select-region-hook
                  #'lost-selection-post-select-region-function))
    (cond ((featurep 'x) (remove-hook 'x-lost-selection-functions
                                      #'lost-selection-function))
          ((featurep 'pgtk) (remove-hook 'pgtk-lost-selection-functions
                                         #'lost-selection-function))
          ((featurep 'haiku) (remove-hook 'haiku-lost-selection-functions
                                          #'lost-selection-function)))
    (remove-hook 'post-select-region-hook
                 #'lost-selection-post-select-region-function)
    (setq lost-selection-last-region-buffer nil)))