2021-03-06 18:03:12 +00:00
|
|
|
|
;;; viper-mous.el --- mouse support for Viper -*- lexical-binding: t; -*-
|
1995-10-30 17:35:01 +00:00
|
|
|
|
|
2023-01-01 10:31:12 +00:00
|
|
|
|
;; Copyright (C) 1994-1997, 2001-2023 Free Software Foundation, Inc.
|
1995-04-08 02:20:38 +00:00
|
|
|
|
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
|
2010-08-29 16:17:13 +00:00
|
|
|
|
;; Package: viper
|
2001-09-09 22:33:38 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 03:28:01 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:28:01 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
2001-07-15 19:53:53 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
1996-03-29 01:02:28 +00:00
|
|
|
|
|
|
|
|
|
;; compiler pacifier
|
|
|
|
|
(defvar double-click-time)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defvar viper-search-start-marker)
|
|
|
|
|
(defvar viper-local-search-start-marker)
|
|
|
|
|
(defvar viper-search-history)
|
|
|
|
|
(defvar viper-s-string)
|
|
|
|
|
(defvar viper-re-search)
|
1997-05-31 00:02:53 +00:00
|
|
|
|
|
|
|
|
|
(require 'viper-util)
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
;; end pacifier
|
1997-05-31 00:02:53 +00:00
|
|
|
|
|
1996-03-29 01:02:28 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(defgroup viper-mouse nil
|
2005-07-04 02:49:51 +00:00
|
|
|
|
"Support for Viper special mouse-bound commands."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
:prefix "viper-"
|
1997-07-17 19:37:07 +00:00
|
|
|
|
:group 'viper)
|
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
;;; Variables
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; Variable used for catching the switch-frame event.
|
|
|
|
|
;; If non-nil, indicates that previous-frame should be the selected
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; one. Used by viper-mouse-click-get-word. Not a user option.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defvar viper-frame-of-focus nil)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; Frame that was selected before the switch-frame event.
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(defvar viper-current-frame-saved (selected-frame))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defcustom viper-surrounding-word-function 'viper-surrounding-word
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"Function that determines what constitutes a word for clicking events.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
Takes two parameters: a COUNT, indicating how many words to return,
|
1995-02-20 23:15:10 +00:00
|
|
|
|
and CLICK-COUNT, telling whether this is the first click, a double-click,
|
2011-11-23 07:03:56 +00:00
|
|
|
|
or a triple-click."
|
2021-03-06 18:03:12 +00:00
|
|
|
|
:type 'symbol)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; time interval in millisecond within which successive clicks are
|
|
|
|
|
;; considered related
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defcustom viper-multiclick-timeout (if (viper-window-display-p)
|
2022-05-02 10:03:08 +00:00
|
|
|
|
(mouse-double-click-time)
|
|
|
|
|
500)
|
2021-09-18 21:39:01 +00:00
|
|
|
|
"Time interval in milliseconds for mouse clicks to be considered related."
|
2021-03-06 18:03:12 +00:00
|
|
|
|
:type 'integer)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
;; Local variable used to toggle wraparound search on click.
|
Obsolete viper-deflocalvar for defvar-local
* lisp/emulation/viper-init.el (viper-deflocalvar): Make obsolete.
Use defvar-local.
* lisp/emulation/viper-cmd.el (viper--undo-change-group-handle):
* lisp/emulation/viper-init.el (viper-vi-intercept-minor-mode)
(viper-vi-basic-minor-mode, viper-vi-local-user-minor-mode)
(viper-vi-global-user-minor-mode)
(viper-vi-state-modifier-minor-mode)
(viper-vi-diehard-minor-mode, viper-vi-kbd-minor-mode)
(viper-insert-intercept-minor-mode)
(viper-insert-basic-minor-mode)
(viper-insert-local-user-minor-mode)
(viper-insert-global-user-minor-mode)
(viper-insert-state-modifier-minor-mode)
(viper-insert-diehard-minor-mode, viper-insert-kbd-minor-mode)
(viper-replace-minor-mode, viper-emacs-intercept-minor-mode)
(viper-emacs-local-user-minor-mode)
(viper-emacs-global-user-minor-mode, viper-emacs-kbd-minor-mode)
(viper-emacs-state-modifier-minor-mode)
(viper-vi-minibuffer-minor-mode)
(viper-insert-minibuffer-minor-mode)
(viper-automatic-iso-accents, viper-special-input-method)
(viper-intermediate-command, viper-began-as-replace)
(viper-replace-overlay, viper-last-posn-in-replace-region)
(viper-last-posn-while-in-insert-state)
(viper-sitting-in-replace, viper-replace-chars-to-delete)
(viper-replace-region-chars-deleted, viper-current-state)
(viper-cted, viper-current-indent, viper-preserve-indent)
(viper-auto-indent, viper-electric-mode, viper-insert-point)
(viper-pre-command-point, viper-com-point)
(viper-ex-style-motion, viper-ex-style-editing)
(viper-ESC-moves-cursor-back, viper-delete-backwards-in-replace)
(viper-related-files-and-buffers-ring)
(viper-local-search-start-marker, viper-search-overlay)
(viper-last-jump, viper-last-jump-ignore)
(viper-minibuffer-current-face, viper-minibuffer-overlay):
* lisp/emulation/viper-keym.el (viper-vi-local-user-map)
(viper-insert-local-user-map, viper-emacs-local-user-map)
(viper--key-maps, viper-need-new-vi-local-map)
(viper-need-new-insert-local-map)
(viper-need-new-emacs-local-map):
* lisp/emulation/viper-mous.el (viper-mouse-click-search-noerror)
(viper-mouse-click-search-limit):
* lisp/emulation/viper-util.el (viper-non-word-characters)
(viper-ALPHA-char-class):
* lisp/emulation/viper.el: Use defvar-local instead of now obsolete
macro viper-deflocalvar.
2021-01-31 13:10:10 +00:00
|
|
|
|
(defvar-local viper-mouse-click-search-noerror t)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; Local variable used to delimit search after wraparound.
|
Obsolete viper-deflocalvar for defvar-local
* lisp/emulation/viper-init.el (viper-deflocalvar): Make obsolete.
Use defvar-local.
* lisp/emulation/viper-cmd.el (viper--undo-change-group-handle):
* lisp/emulation/viper-init.el (viper-vi-intercept-minor-mode)
(viper-vi-basic-minor-mode, viper-vi-local-user-minor-mode)
(viper-vi-global-user-minor-mode)
(viper-vi-state-modifier-minor-mode)
(viper-vi-diehard-minor-mode, viper-vi-kbd-minor-mode)
(viper-insert-intercept-minor-mode)
(viper-insert-basic-minor-mode)
(viper-insert-local-user-minor-mode)
(viper-insert-global-user-minor-mode)
(viper-insert-state-modifier-minor-mode)
(viper-insert-diehard-minor-mode, viper-insert-kbd-minor-mode)
(viper-replace-minor-mode, viper-emacs-intercept-minor-mode)
(viper-emacs-local-user-minor-mode)
(viper-emacs-global-user-minor-mode, viper-emacs-kbd-minor-mode)
(viper-emacs-state-modifier-minor-mode)
(viper-vi-minibuffer-minor-mode)
(viper-insert-minibuffer-minor-mode)
(viper-automatic-iso-accents, viper-special-input-method)
(viper-intermediate-command, viper-began-as-replace)
(viper-replace-overlay, viper-last-posn-in-replace-region)
(viper-last-posn-while-in-insert-state)
(viper-sitting-in-replace, viper-replace-chars-to-delete)
(viper-replace-region-chars-deleted, viper-current-state)
(viper-cted, viper-current-indent, viper-preserve-indent)
(viper-auto-indent, viper-electric-mode, viper-insert-point)
(viper-pre-command-point, viper-com-point)
(viper-ex-style-motion, viper-ex-style-editing)
(viper-ESC-moves-cursor-back, viper-delete-backwards-in-replace)
(viper-related-files-and-buffers-ring)
(viper-local-search-start-marker, viper-search-overlay)
(viper-last-jump, viper-last-jump-ignore)
(viper-minibuffer-current-face, viper-minibuffer-overlay):
* lisp/emulation/viper-keym.el (viper-vi-local-user-map)
(viper-insert-local-user-map, viper-emacs-local-user-map)
(viper--key-maps, viper-need-new-vi-local-map)
(viper-need-new-insert-local-map)
(viper-need-new-emacs-local-map):
* lisp/emulation/viper-mous.el (viper-mouse-click-search-noerror)
(viper-mouse-click-search-limit):
* lisp/emulation/viper-util.el (viper-non-word-characters)
(viper-ALPHA-char-class):
* lisp/emulation/viper.el: Use defvar-local instead of now obsolete
macro viper-deflocalvar.
2021-01-31 13:10:10 +00:00
|
|
|
|
(defvar-local viper-mouse-click-search-limit nil)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; remembers prefix argument to pass along to commands invoked by second
|
|
|
|
|
;; click.
|
2021-10-08 18:41:50 +00:00
|
|
|
|
;; This is needed because assigning to prefix-arg causes Emacs to
|
|
|
|
|
;; count the second click as if it was a single click
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defvar viper-global-prefix-argument nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; same keys, but parsed
|
|
|
|
|
(defvar viper-mouse-up-search-key-parsed nil)
|
|
|
|
|
(defvar viper-mouse-down-search-key-parsed nil)
|
|
|
|
|
(defvar viper-mouse-up-insert-key-parsed nil)
|
|
|
|
|
(defvar viper-mouse-down-insert-key-parsed nil)
|
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Code
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defsubst viper-multiclick-p ()
|
2020-08-16 19:40:28 +00:00
|
|
|
|
(not (sit-for (/ viper-multiclick-timeout 1000.0) t)))
|
1996-01-26 23:34:09 +00:00
|
|
|
|
|
|
|
|
|
;; Returns window where click occurs
|
1997-11-01 01:46:51 +00:00
|
|
|
|
(defun viper-mouse-click-window (click)
|
2019-10-21 19:19:25 +00:00
|
|
|
|
(let ((win (posn-window (event-start click))))
|
1997-11-01 01:46:51 +00:00
|
|
|
|
(if (window-live-p win)
|
|
|
|
|
win
|
|
|
|
|
(error "Click was not over a live window"))))
|
1996-01-26 23:34:09 +00:00
|
|
|
|
|
|
|
|
|
;; Returns window where click occurs
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defsubst viper-mouse-click-frame (click)
|
|
|
|
|
(window-frame (viper-mouse-click-window click)))
|
1996-01-26 23:34:09 +00:00
|
|
|
|
|
|
|
|
|
;; Returns the buffer of the window where click occurs
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defsubst viper-mouse-click-window-buffer (click)
|
|
|
|
|
(window-buffer (viper-mouse-click-window click)))
|
1996-01-26 23:34:09 +00:00
|
|
|
|
|
|
|
|
|
;; Returns the name of the buffer in the window where click occurs
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defsubst viper-mouse-click-window-buffer-name (click)
|
|
|
|
|
(buffer-name (viper-mouse-click-window-buffer click)))
|
1996-01-26 23:34:09 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defsubst viper-mouse-click-posn (click)
|
2021-09-14 06:43:18 +00:00
|
|
|
|
"Return position of a click."
|
2019-10-21 19:19:25 +00:00
|
|
|
|
(declare (obsolete nil "27.1"))
|
|
|
|
|
(posn-point (event-start click)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1996-01-26 23:34:09 +00:00
|
|
|
|
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
|
|
|
|
|
(declare-function viper-backward-char-carefully "viper-cmd" (&optional arg))
|
|
|
|
|
(declare-function viper-forward-char-carefully "viper-cmd" (&optional arg))
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-surrounding-word (count click-count)
|
lisp/*.el: Fix typos and improve some docstrings
* lisp/auth-source.el (auth-source-backend-parse-parameters)
(auth-source-search-collection)
(auth-source-secrets-listify-pattern)
(auth-source--decode-octal-string, auth-source-plstore-search):
* lisp/registry.el (registry-lookup)
(registry-lookup-breaks-before-lexbind)
(registry-lookup-secondary, registry-lookup-secondary-value)
(registry-search, registry-delete, registry-size, registry-full)
(registry-insert, registry-reindex, registry-prune)
(registry-collect-prune-candidates):
* lisp/subr.el (nbutlast, process-live-p):
* lisp/tab-bar.el (tab-bar-list):
* lisp/cedet/ede/linux.el (ede-linux--get-archs)
(ede-linux--include-path, ede-linux-load):
* lisp/erc/erc-log.el (erc-log-all-but-server-buffers):
* lisp/erc/erc-pcomplete.el (pcomplete-erc-commands)
(pcomplete-erc-ops, pcomplete-erc-not-ops, pcomplete-erc-nicks)
(pcomplete-erc-all-nicks, pcomplete-erc-channels)
(pcomplete-erc-command-name, pcomplete-erc-parse-arguments):
* lisp/eshell/em-term.el (eshell-visual-command-p):
* lisp/gnus/gnus-cache.el (gnus-cache-fully-p):
* lisp/gnus/nnmail.el (nnmail-get-active)
(nnmail-fancy-expiry-target):
* lisp/mail/mail-utils.el (mail-string-delete):
* lisp/mail/supercite.el (sc-hdr, sc-valid-index-p):
* lisp/net/ange-ftp.el (ange-ftp-use-smart-gateway-p):
* lisp/net/nsm.el (nsm-save-fingerprint-maybe)
(nsm-network-same-subnet, nsm-should-check):
* lisp/net/rcirc.el (rcirc-looking-at-input):
* lisp/net/tramp-cache.el (tramp-get-hash-table):
* lisp/net/tramp-compat.el (tramp-compat-process-running-p):
* lisp/net/tramp-smb.el (tramp-smb-get-share)
(tramp-smb-get-localname, tramp-smb-read-file-entry)
(tramp-smb-get-cifs-capabilities, tramp-smb-get-stat-capability):
* lisp/net/zeroconf.el (zeroconf-list-service-names)
(zeroconf-list-service-types, zeroconf-list-services)
(zeroconf-get-host, zeroconf-get-domain)
(zeroconf-get-host-domain):
* lisp/nxml/rng-xsd.el (rng-xsd-compile)
(rng-xsd-make-date-time-regexp, rng-xsd-convert-date-time):
* lisp/obsolete/erc-hecomplete.el (erc-hecomplete)
(erc-command-list, erc-complete-at-prompt):
* lisp/org/ob-scheme.el (org-babel-scheme-get-buffer-impl):
* lisp/org/ob-shell.el (org-babel--variable-assignments:sh-generic)
(org-babel--variable-assignments:bash_array)
(org-babel--variable-assignments:bash_assoc)
(org-babel--variable-assignments:bash):
* lisp/org/org-clock.el (org-day-of-week):
* lisp/progmodes/cperl-mode.el (cperl-char-ends-sub-keyword-p):
* lisp/progmodes/gud.el (gud-find-c-expr, gud-innermost-expr)
(gud-prev-expr, gud-next-expr):
* lisp/textmodes/table.el (table--at-cell-p, table--probe-cell)
(table--get-cell-justify-property)
(table--get-cell-valign-property)
(table--put-cell-justify-property)
(table--put-cell-valign-property): Fix typos.
* lisp/so-long.el (fboundp): Doc fix.
(so-long-mode-line-info, so-long-mode)
(so-long--check-header-modes): Fix typos.
* lisp/emulation/viper-mous.el (viper-surrounding-word)
(viper-mouse-click-get-word): Fix typos.
(viper-mouse-click-search-word): Doc fix.
* lisp/erc/erc-backend.el (erc-forward-word, erc-word-at-arg-p)
(erc-bounds-of-word-at-point): Fix typos.
(erc-decode-string-from-target, define-erc-response-handler):
Refill docstring.
* lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): Fix typo.
(erc-dcc-get-host, erc-dcc-auto-mask-p, erc-dcc-get-file):
Doc fixes.
* lisp/erc/erc-networks.el (erc-network-name): Fix typo.
(erc-determine-network): Refill docstring.
* lisp/net/dbus.el (dbus-list-hash-table)
(dbus-string-to-byte-array, dbus-byte-array-to-string)
(dbus-check-event): Fix typos.
(dbus-introspect-get-property): Doc fix.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler):
Rename ARGS to ARGUMENTS. Doc fix.
(tramp-adb-sh-fix-ls-output, tramp-adb-execute-adb-command)
(tramp-adb-find-test-command): Fix typos.
* lisp/net/tramp.el (tramp-set-completion-function)
(tramp-get-completion-function)
(tramp-completion-dissect-file-name)
(tramp-completion-dissect-file-name1)
(tramp-get-completion-methods, tramp-get-completion-user-host)
(tramp-get-inode, tramp-get-device, tramp-mode-string-to-int)
(tramp-call-process, tramp-call-process-region)
(tramp-process-lines): Fix typos.
(tramp-interrupt-process): Doc fix.
* lisp/org/ob-core.el (org-babel-named-src-block-regexp-for-name)
(org-babel-named-data-regexp-for-name): Doc fix.
(org-babel-src-block-names, org-babel-result-names): Fix typos.
* lisp/progmodes/inf-lisp.el (lisp-input-filter): Doc fix.
(lisp-fn-called-at-pt): Fix typo.
* lisp/progmodes/xref.el (xref-backend-identifier-at-point):
Doc fix.
(xref-backend-identifier-completion-table): Fix typo.
2019-10-20 10:12:27 +00:00
|
|
|
|
"Return word surrounding point according to a heuristic.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
COUNT indicates how many regions to return.
|
1995-07-27 19:41:08 +00:00
|
|
|
|
If CLICK-COUNT is 1, `word' is a word in Vi sense.
|
|
|
|
|
If CLICK-COUNT is 2,then `word' is a Word in Vi sense.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
If the character clicked on is a non-separator and is non-alphanumeric but
|
|
|
|
|
is adjacent to an alphanumeric symbol, then it is considered alphanumeric
|
1999-11-01 07:16:15 +00:00
|
|
|
|
for the purpose of this command. If this character has a matching
|
2015-09-17 23:08:20 +00:00
|
|
|
|
character, such as `(' is a match for `)', then the matching character is
|
1995-02-20 23:15:10 +00:00
|
|
|
|
also considered alphanumeric.
|
1995-07-27 19:41:08 +00:00
|
|
|
|
For convenience, in Lisp modes, `-' is considered alphanumeric.
|
|
|
|
|
|
|
|
|
|
If CLICK-COUNT is 3 or more, returns the line clicked on with leading and
|
1999-11-01 07:16:15 +00:00
|
|
|
|
trailing space and tabs removed. In that case, the first argument, COUNT,
|
1995-07-27 19:41:08 +00:00
|
|
|
|
is ignored."
|
1998-05-30 14:29:44 +00:00
|
|
|
|
(let ((modifiers "_")
|
1995-08-20 04:30:48 +00:00
|
|
|
|
beg skip-flag result
|
1995-10-14 02:26:46 +00:00
|
|
|
|
word-beg)
|
1995-08-20 04:30:48 +00:00
|
|
|
|
(if (> click-count 2)
|
1995-07-27 19:41:08 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-skip-all-separators-forward 'within-line)
|
1995-07-27 19:41:08 +00:00
|
|
|
|
(setq beg (point))
|
|
|
|
|
(end-of-line)
|
1995-08-20 04:30:48 +00:00
|
|
|
|
(setq result (buffer-substring beg (point))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if (and (not (viper-looking-at-alphasep))
|
|
|
|
|
(or (save-excursion (viper-backward-char-carefully)
|
|
|
|
|
(viper-looking-at-alpha))
|
|
|
|
|
(save-excursion (viper-forward-char-carefully)
|
|
|
|
|
(viper-looking-at-alpha))))
|
1995-10-14 02:26:46 +00:00
|
|
|
|
(setq modifiers
|
1998-05-30 14:29:44 +00:00
|
|
|
|
(concat modifiers
|
|
|
|
|
(cond ((looking-at "\\\\") "\\\\")
|
|
|
|
|
((looking-at "-") "C-C-")
|
|
|
|
|
((looking-at "[][]") "][")
|
|
|
|
|
((looking-at "[()]") ")(")
|
|
|
|
|
((looking-at "[{}]") "{}")
|
|
|
|
|
((looking-at "[<>]") "<>")
|
|
|
|
|
((looking-at "[`']") "`'")
|
|
|
|
|
((looking-at "\\^") "\\^")
|
|
|
|
|
((viper-looking-at-separator) "")
|
|
|
|
|
(t (char-to-string (following-char))))
|
|
|
|
|
)
|
1995-10-14 02:26:46 +00:00
|
|
|
|
))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-10-14 02:26:46 +00:00
|
|
|
|
;; Add `-' to alphanum, if it wasn't added and if we are in Lisp
|
1995-07-27 19:41:08 +00:00
|
|
|
|
(or (looking-at "-")
|
|
|
|
|
(not (string-match "lisp" (symbol-name major-mode)))
|
1995-10-14 02:26:46 +00:00
|
|
|
|
(setq modifiers (concat modifiers "C-C-")))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
|
|
|
|
|
1995-07-27 19:41:08 +00:00
|
|
|
|
(save-excursion
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(cond ((> click-count 1) (viper-skip-nonseparators 'backward))
|
|
|
|
|
((viper-looking-at-alpha modifiers)
|
|
|
|
|
(viper-skip-alpha-backward modifiers))
|
|
|
|
|
((not (viper-looking-at-alphasep modifiers))
|
|
|
|
|
(viper-skip-nonalphasep-backward))
|
1995-10-14 02:26:46 +00:00
|
|
|
|
(t (if (> click-count 1)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-skip-nonseparators 'backward)
|
|
|
|
|
(viper-skip-alpha-backward modifiers))))
|
1995-10-14 02:26:46 +00:00
|
|
|
|
|
1995-07-27 19:41:08 +00:00
|
|
|
|
(setq word-beg (point))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-10-14 02:26:46 +00:00
|
|
|
|
(setq skip-flag nil) ; don't move 1 char forw the first time
|
1995-07-27 19:41:08 +00:00
|
|
|
|
(while (> count 0)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if skip-flag (viper-forward-char-carefully 1))
|
1995-10-14 02:26:46 +00:00
|
|
|
|
(setq skip-flag t) ; now always move 1 char forward
|
|
|
|
|
(if (> click-count 1)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-skip-nonseparators 'forward)
|
|
|
|
|
(viper-skip-alpha-forward modifiers))
|
1995-07-27 19:41:08 +00:00
|
|
|
|
(setq count (1- count)))
|
1995-10-14 02:26:46 +00:00
|
|
|
|
|
1995-08-20 04:30:48 +00:00
|
|
|
|
(setq result (buffer-substring word-beg (point))))
|
|
|
|
|
) ; if
|
2021-11-17 05:25:50 +00:00
|
|
|
|
;; FIXME: Use `buffer-substring-no-properties' above instead?
|
2019-10-04 12:29:58 +00:00
|
|
|
|
(set-text-properties 0 (length result) nil result)
|
|
|
|
|
result))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-mouse-click-get-word (click count click-count)
|
lisp/*.el: Fix typos and improve some docstrings
* lisp/auth-source.el (auth-source-backend-parse-parameters)
(auth-source-search-collection)
(auth-source-secrets-listify-pattern)
(auth-source--decode-octal-string, auth-source-plstore-search):
* lisp/registry.el (registry-lookup)
(registry-lookup-breaks-before-lexbind)
(registry-lookup-secondary, registry-lookup-secondary-value)
(registry-search, registry-delete, registry-size, registry-full)
(registry-insert, registry-reindex, registry-prune)
(registry-collect-prune-candidates):
* lisp/subr.el (nbutlast, process-live-p):
* lisp/tab-bar.el (tab-bar-list):
* lisp/cedet/ede/linux.el (ede-linux--get-archs)
(ede-linux--include-path, ede-linux-load):
* lisp/erc/erc-log.el (erc-log-all-but-server-buffers):
* lisp/erc/erc-pcomplete.el (pcomplete-erc-commands)
(pcomplete-erc-ops, pcomplete-erc-not-ops, pcomplete-erc-nicks)
(pcomplete-erc-all-nicks, pcomplete-erc-channels)
(pcomplete-erc-command-name, pcomplete-erc-parse-arguments):
* lisp/eshell/em-term.el (eshell-visual-command-p):
* lisp/gnus/gnus-cache.el (gnus-cache-fully-p):
* lisp/gnus/nnmail.el (nnmail-get-active)
(nnmail-fancy-expiry-target):
* lisp/mail/mail-utils.el (mail-string-delete):
* lisp/mail/supercite.el (sc-hdr, sc-valid-index-p):
* lisp/net/ange-ftp.el (ange-ftp-use-smart-gateway-p):
* lisp/net/nsm.el (nsm-save-fingerprint-maybe)
(nsm-network-same-subnet, nsm-should-check):
* lisp/net/rcirc.el (rcirc-looking-at-input):
* lisp/net/tramp-cache.el (tramp-get-hash-table):
* lisp/net/tramp-compat.el (tramp-compat-process-running-p):
* lisp/net/tramp-smb.el (tramp-smb-get-share)
(tramp-smb-get-localname, tramp-smb-read-file-entry)
(tramp-smb-get-cifs-capabilities, tramp-smb-get-stat-capability):
* lisp/net/zeroconf.el (zeroconf-list-service-names)
(zeroconf-list-service-types, zeroconf-list-services)
(zeroconf-get-host, zeroconf-get-domain)
(zeroconf-get-host-domain):
* lisp/nxml/rng-xsd.el (rng-xsd-compile)
(rng-xsd-make-date-time-regexp, rng-xsd-convert-date-time):
* lisp/obsolete/erc-hecomplete.el (erc-hecomplete)
(erc-command-list, erc-complete-at-prompt):
* lisp/org/ob-scheme.el (org-babel-scheme-get-buffer-impl):
* lisp/org/ob-shell.el (org-babel--variable-assignments:sh-generic)
(org-babel--variable-assignments:bash_array)
(org-babel--variable-assignments:bash_assoc)
(org-babel--variable-assignments:bash):
* lisp/org/org-clock.el (org-day-of-week):
* lisp/progmodes/cperl-mode.el (cperl-char-ends-sub-keyword-p):
* lisp/progmodes/gud.el (gud-find-c-expr, gud-innermost-expr)
(gud-prev-expr, gud-next-expr):
* lisp/textmodes/table.el (table--at-cell-p, table--probe-cell)
(table--get-cell-justify-property)
(table--get-cell-valign-property)
(table--put-cell-justify-property)
(table--put-cell-valign-property): Fix typos.
* lisp/so-long.el (fboundp): Doc fix.
(so-long-mode-line-info, so-long-mode)
(so-long--check-header-modes): Fix typos.
* lisp/emulation/viper-mous.el (viper-surrounding-word)
(viper-mouse-click-get-word): Fix typos.
(viper-mouse-click-search-word): Doc fix.
* lisp/erc/erc-backend.el (erc-forward-word, erc-word-at-arg-p)
(erc-bounds-of-word-at-point): Fix typos.
(erc-decode-string-from-target, define-erc-response-handler):
Refill docstring.
* lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): Fix typo.
(erc-dcc-get-host, erc-dcc-auto-mask-p, erc-dcc-get-file):
Doc fixes.
* lisp/erc/erc-networks.el (erc-network-name): Fix typo.
(erc-determine-network): Refill docstring.
* lisp/net/dbus.el (dbus-list-hash-table)
(dbus-string-to-byte-array, dbus-byte-array-to-string)
(dbus-check-event): Fix typos.
(dbus-introspect-get-property): Doc fix.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler):
Rename ARGS to ARGUMENTS. Doc fix.
(tramp-adb-sh-fix-ls-output, tramp-adb-execute-adb-command)
(tramp-adb-find-test-command): Fix typos.
* lisp/net/tramp.el (tramp-set-completion-function)
(tramp-get-completion-function)
(tramp-completion-dissect-file-name)
(tramp-completion-dissect-file-name1)
(tramp-get-completion-methods, tramp-get-completion-user-host)
(tramp-get-inode, tramp-get-device, tramp-mode-string-to-int)
(tramp-call-process, tramp-call-process-region)
(tramp-process-lines): Fix typos.
(tramp-interrupt-process): Doc fix.
* lisp/org/ob-core.el (org-babel-named-src-block-regexp-for-name)
(org-babel-named-data-regexp-for-name): Doc fix.
(org-babel-src-block-names, org-babel-result-names): Fix typos.
* lisp/progmodes/inf-lisp.el (lisp-input-filter): Doc fix.
(lisp-fn-called-at-pt): Fix typo.
* lisp/progmodes/xref.el (xref-backend-identifier-at-point):
Doc fix.
(xref-backend-identifier-completion-table): Fix typo.
2019-10-20 10:12:27 +00:00
|
|
|
|
"Return word surrounding the position of a mouse click.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
Click may be in another window. Current window and buffer isn't changed.
|
1995-07-27 19:41:08 +00:00
|
|
|
|
On single or double click, returns the word as determined by
|
1997-08-02 07:40:22 +00:00
|
|
|
|
`viper-surrounding-word-function'."
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(let ((click-word "")
|
2019-10-21 19:19:25 +00:00
|
|
|
|
(click-pos (posn-point (event-start click)))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(click-buf (viper-mouse-click-window-buffer click)))
|
1996-06-22 01:54:34 +00:00
|
|
|
|
(or (natnump count) (setq count 1))
|
|
|
|
|
(or (natnump click-count) (setq click-count 1))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(if click-pos
|
|
|
|
|
(progn
|
|
|
|
|
(set-buffer click-buf)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(goto-char click-pos)
|
|
|
|
|
(setq click-word
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(funcall viper-surrounding-word-function count click-count)))
|
2001-07-15 19:53:53 +00:00
|
|
|
|
(error "Click must be over a window"))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
click-word))))
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-mouse-click-insert-word (click arg)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
"Insert word clicked or double-clicked on.
|
|
|
|
|
With prefix argument, N, insert that many words.
|
|
|
|
|
This command must be bound to a mouse click.
|
|
|
|
|
The double-click action of the same mouse button must not be bound
|
2015-09-17 23:08:20 +00:00
|
|
|
|
\(or it must be bound to the same function).
|
1997-08-02 07:40:22 +00:00
|
|
|
|
See `viper-surrounding-word' for the definition of a word in this case."
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(interactive "e\nP")
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if viper-frame-of-focus ;; to handle clicks in another frame
|
|
|
|
|
(select-frame viper-frame-of-focus))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(if (save-excursion
|
|
|
|
|
(or (not (eq (key-binding viper-mouse-down-insert-key-parsed)
|
|
|
|
|
'viper-mouse-catch-frame-switch))
|
|
|
|
|
(not (eq (key-binding viper-mouse-up-insert-key-parsed)
|
2019-10-21 19:19:25 +00:00
|
|
|
|
'viper-mouse-click-insert-word))))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
() ; do nothing, if binding isn't right or not over text
|
|
|
|
|
;; turn arg into a number
|
|
|
|
|
(cond ((integerp arg) nil)
|
|
|
|
|
;; prefix arg is a list when one hits C-u then command
|
|
|
|
|
((and (listp arg) (integerp (car arg)))
|
|
|
|
|
(setq arg (car arg)))
|
|
|
|
|
(t (setq arg 1)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(if (not (eq (key-binding viper-mouse-down-insert-key-parsed)
|
|
|
|
|
'viper-mouse-catch-frame-switch))
|
|
|
|
|
() ; do nothing
|
|
|
|
|
(let (click-count interrupting-event)
|
|
|
|
|
(if (and
|
|
|
|
|
(viper-multiclick-p)
|
|
|
|
|
;; This trick checks if there is a pending mouse event if so, we
|
|
|
|
|
;; use this latter event and discard the current mouse click If
|
|
|
|
|
;; the next pending event is not a mouse event, we execute the
|
|
|
|
|
;; current mouse event
|
|
|
|
|
(progn
|
Remove most of the XEmacs compat code from viper*.el
* lisp/emulation/viper-cmd.el ()
(viper-insert-state-post-command-sentinel)
(viper-change-state-to-vi, viper-change-state-to-insert)
(viper-change-state-to-emacs, viper-escape-to-state)
(viper-special-read-and-insert-char, viper-toggle-key-action)
(viper-prefix-arg-value, viper-prefix-arg-com)
(viper-digit-argument, viper-command-argument, )
(viper-exec-Yank, viper-repeat, viper-forward-char)
(viper-backward-char, viper-forward-word, viper-forward-Word)
(viper-end-of-word, viper-end-of-Word, viper-backward-word)
(viper-backward-Word, viper-beginning-of-line)
(viper-bol-and-skip-white, viper-goto-eol, viper-goto-col)
(viper-next-line, viper-next-line-at-bol, viper-previous-line)
(viper-previous-line-at-bol, viper-goto-line, )
(viper-repeat-find, viper-repeat-find-opposite)
(viper-window-top, viper-window-middle, viper-window-bottom)
(viper-paren-match, viper-search, viper-buffer-search-enable)
(viper-put-back, viper-Put-back, viper-mark-point)
(viper-cycle-through-mark-ring, viper-goto-mark-subr)
(viper-brac-function, viper-register-to-point)
(viper-submit-report): Remove some XEmacs compat code.
* lisp/emulation/viper-ex.el (viper-get-ex-address-subr)
(viper-handle-!, ex-edit, ex-mark, ex-next-related-buffer)
(ex-help, ex-write, ex-write-info, viper-info-on-file): Ditto.
* lisp/emulation/viper-keym.el (viper-add-keymap): Ditto.
* lisp/emulation/viper-macs.el (viper-record-kbd-macro): Remove
XEmacs compat code.
* lisp/emulation/viper-mous.el (viper-mouse-click-insert-word)
(viper-mouse-click-search-word): Remove some XEmacs compat code.
* lisp/emulation/viper-util.el (viper-overlay-p)
(viper-color-defined-p, viper-iconify, viper-memq-char)
(viper-char-equal, viper=, viper-color-display-p)
(viper-get-cursor-color, viper-frame-value)
(viper-change-cursor-color, viper-save-cursor-color)
(viper-restore-cursor-color, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-put-on-search-overlay)
(viper-flash-search-pattern, viper-hide-search-overlay)
(viper-move-replace-overlay, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-hide-replace-overlay)
(viper-replace-start, viper-replace-end)
(viper-set-minibuffer-overlay, viper-check-minibuffer-overlay)
(viper-abbreviate-file-name, viper-mark-marker)
(viper-set-mark-if-necessary, viper-leave-region-active)
(viper-copy-event, viper-read-event-convert-to-char)
(viper-event-key, viper-last-command-char)
(viper-key-to-emacs-key, viper-eventify-list-xemacs)
(viper-set-unread-command-events, viper-char-array-p)
(viper-key-press-events-to-chars, viper-read-char-exclusive):
Remove most of the XEmacs compat code.
* lisp/emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings): Remove some XEmacs compat code.
2019-06-19 22:48:49 +00:00
|
|
|
|
(setq interrupting-event (read-event))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(viper-mouse-event-p last-input-event)))
|
|
|
|
|
(progn ; interrupted wait
|
2020-03-01 00:42:36 +00:00
|
|
|
|
(setq viper-global-prefix-argument arg))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
;; uninterrupted wait or the interrupting event wasn't a mouse event
|
2020-03-01 00:42:36 +00:00
|
|
|
|
(setq click-count (event-click-count click))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(if (> click-count 1)
|
|
|
|
|
(setq arg viper-global-prefix-argument
|
|
|
|
|
viper-global-prefix-argument nil))
|
|
|
|
|
(insert (viper-mouse-click-get-word click arg click-count))
|
|
|
|
|
(if (and interrupting-event
|
|
|
|
|
(eventp interrupting-event)
|
|
|
|
|
(not (viper-mouse-event-p interrupting-event)))
|
|
|
|
|
(viper-set-unread-command-events interrupting-event))
|
|
|
|
|
)))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Arg is an event. Accepts symbols and numbers, too
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-mouse-event-p (event)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(if (eventp event)
|
|
|
|
|
(string-match "\\(mouse-\\|frame\\|screen\\|track\\)"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(prin1-to-string (viper-event-key event)))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2020-03-01 00:42:36 +00:00
|
|
|
|
(define-obsolete-function-alias 'viper-event-click-count
|
2021-03-06 18:03:12 +00:00
|
|
|
|
#'event-click-count "28.1")
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
Small viper clean-up
* lisp/emulation/viper-cmd.el (viper-set-searchstyle-toggling-macros)
(viper-set-parsing-style-toggling-macro)
(viper-set-emacs-state-searchstyle-macros):
Use called-interactively-p on Emacs.
(viper-looking-back): Make it an obsolete alias. Update callers.
* lisp/emulation/viper-ex.el: Load viper-keym, not viper-cmd.
Use looking-back rather than viper-looking-back.
(viper-tmp-insert-at-eob, viper-enlarge-region)
(viper-read-string-with-history, viper-register-to-point)
(viper-append-to-register, viper-change-state-to-vi)
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-Put-back, viper-put-back, viper-add-newline-at-eob-if-necessary)
(viper-change-state-to-emacs): Declare.
* lisp/emulation/viper-macs.el: Load viper-mous, viper-ex, not viper-cmd.
(viper-change-state-to-insert, viper-change-state-to-vi): Declare.
* lisp/emulation/viper-mous.el: Do not load viper-cmd.
(viper-backward-char-carefully, viper-forward-char-carefully)
(viper-forward-word, viper-adjust-window): Declare.
2013-05-22 03:21:30 +00:00
|
|
|
|
(declare-function viper-forward-word "viper-cmd" (arg))
|
|
|
|
|
(declare-function viper-adjust-window "viper-cmd" ())
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-mouse-click-search-word (click arg)
|
lisp/*.el: Fix typos and improve some docstrings
* lisp/auth-source.el (auth-source-backend-parse-parameters)
(auth-source-search-collection)
(auth-source-secrets-listify-pattern)
(auth-source--decode-octal-string, auth-source-plstore-search):
* lisp/registry.el (registry-lookup)
(registry-lookup-breaks-before-lexbind)
(registry-lookup-secondary, registry-lookup-secondary-value)
(registry-search, registry-delete, registry-size, registry-full)
(registry-insert, registry-reindex, registry-prune)
(registry-collect-prune-candidates):
* lisp/subr.el (nbutlast, process-live-p):
* lisp/tab-bar.el (tab-bar-list):
* lisp/cedet/ede/linux.el (ede-linux--get-archs)
(ede-linux--include-path, ede-linux-load):
* lisp/erc/erc-log.el (erc-log-all-but-server-buffers):
* lisp/erc/erc-pcomplete.el (pcomplete-erc-commands)
(pcomplete-erc-ops, pcomplete-erc-not-ops, pcomplete-erc-nicks)
(pcomplete-erc-all-nicks, pcomplete-erc-channels)
(pcomplete-erc-command-name, pcomplete-erc-parse-arguments):
* lisp/eshell/em-term.el (eshell-visual-command-p):
* lisp/gnus/gnus-cache.el (gnus-cache-fully-p):
* lisp/gnus/nnmail.el (nnmail-get-active)
(nnmail-fancy-expiry-target):
* lisp/mail/mail-utils.el (mail-string-delete):
* lisp/mail/supercite.el (sc-hdr, sc-valid-index-p):
* lisp/net/ange-ftp.el (ange-ftp-use-smart-gateway-p):
* lisp/net/nsm.el (nsm-save-fingerprint-maybe)
(nsm-network-same-subnet, nsm-should-check):
* lisp/net/rcirc.el (rcirc-looking-at-input):
* lisp/net/tramp-cache.el (tramp-get-hash-table):
* lisp/net/tramp-compat.el (tramp-compat-process-running-p):
* lisp/net/tramp-smb.el (tramp-smb-get-share)
(tramp-smb-get-localname, tramp-smb-read-file-entry)
(tramp-smb-get-cifs-capabilities, tramp-smb-get-stat-capability):
* lisp/net/zeroconf.el (zeroconf-list-service-names)
(zeroconf-list-service-types, zeroconf-list-services)
(zeroconf-get-host, zeroconf-get-domain)
(zeroconf-get-host-domain):
* lisp/nxml/rng-xsd.el (rng-xsd-compile)
(rng-xsd-make-date-time-regexp, rng-xsd-convert-date-time):
* lisp/obsolete/erc-hecomplete.el (erc-hecomplete)
(erc-command-list, erc-complete-at-prompt):
* lisp/org/ob-scheme.el (org-babel-scheme-get-buffer-impl):
* lisp/org/ob-shell.el (org-babel--variable-assignments:sh-generic)
(org-babel--variable-assignments:bash_array)
(org-babel--variable-assignments:bash_assoc)
(org-babel--variable-assignments:bash):
* lisp/org/org-clock.el (org-day-of-week):
* lisp/progmodes/cperl-mode.el (cperl-char-ends-sub-keyword-p):
* lisp/progmodes/gud.el (gud-find-c-expr, gud-innermost-expr)
(gud-prev-expr, gud-next-expr):
* lisp/textmodes/table.el (table--at-cell-p, table--probe-cell)
(table--get-cell-justify-property)
(table--get-cell-valign-property)
(table--put-cell-justify-property)
(table--put-cell-valign-property): Fix typos.
* lisp/so-long.el (fboundp): Doc fix.
(so-long-mode-line-info, so-long-mode)
(so-long--check-header-modes): Fix typos.
* lisp/emulation/viper-mous.el (viper-surrounding-word)
(viper-mouse-click-get-word): Fix typos.
(viper-mouse-click-search-word): Doc fix.
* lisp/erc/erc-backend.el (erc-forward-word, erc-word-at-arg-p)
(erc-bounds-of-word-at-point): Fix typos.
(erc-decode-string-from-target, define-erc-response-handler):
Refill docstring.
* lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): Fix typo.
(erc-dcc-get-host, erc-dcc-auto-mask-p, erc-dcc-get-file):
Doc fixes.
* lisp/erc/erc-networks.el (erc-network-name): Fix typo.
(erc-determine-network): Refill docstring.
* lisp/net/dbus.el (dbus-list-hash-table)
(dbus-string-to-byte-array, dbus-byte-array-to-string)
(dbus-check-event): Fix typos.
(dbus-introspect-get-property): Doc fix.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler):
Rename ARGS to ARGUMENTS. Doc fix.
(tramp-adb-sh-fix-ls-output, tramp-adb-execute-adb-command)
(tramp-adb-find-test-command): Fix typos.
* lisp/net/tramp.el (tramp-set-completion-function)
(tramp-get-completion-function)
(tramp-completion-dissect-file-name)
(tramp-completion-dissect-file-name1)
(tramp-get-completion-methods, tramp-get-completion-user-host)
(tramp-get-inode, tramp-get-device, tramp-mode-string-to-int)
(tramp-call-process, tramp-call-process-region)
(tramp-process-lines): Fix typos.
(tramp-interrupt-process): Doc fix.
* lisp/org/ob-core.el (org-babel-named-src-block-regexp-for-name)
(org-babel-named-data-regexp-for-name): Doc fix.
(org-babel-src-block-names, org-babel-result-names): Fix typos.
* lisp/progmodes/inf-lisp.el (lisp-input-filter): Doc fix.
(lisp-fn-called-at-pt): Fix typo.
* lisp/progmodes/xref.el (xref-backend-identifier-at-point):
Doc fix.
(xref-backend-identifier-completion-table): Fix typo.
2019-10-20 10:12:27 +00:00
|
|
|
|
"Find the word clicked or double-clicked on. Word may be in another window.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
With prefix argument, N, search for N-th occurrence.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
This command must be bound to a mouse click. The double-click action of the
|
2015-09-17 23:08:20 +00:00
|
|
|
|
same button must not be bound \(or it must be bound to the same function).
|
1997-08-02 07:40:22 +00:00
|
|
|
|
See `viper-surrounding-word' for the details on what constitutes a word for
|
lisp/*.el: Fix typos and improve some docstrings
* lisp/auth-source.el (auth-source-backend-parse-parameters)
(auth-source-search-collection)
(auth-source-secrets-listify-pattern)
(auth-source--decode-octal-string, auth-source-plstore-search):
* lisp/registry.el (registry-lookup)
(registry-lookup-breaks-before-lexbind)
(registry-lookup-secondary, registry-lookup-secondary-value)
(registry-search, registry-delete, registry-size, registry-full)
(registry-insert, registry-reindex, registry-prune)
(registry-collect-prune-candidates):
* lisp/subr.el (nbutlast, process-live-p):
* lisp/tab-bar.el (tab-bar-list):
* lisp/cedet/ede/linux.el (ede-linux--get-archs)
(ede-linux--include-path, ede-linux-load):
* lisp/erc/erc-log.el (erc-log-all-but-server-buffers):
* lisp/erc/erc-pcomplete.el (pcomplete-erc-commands)
(pcomplete-erc-ops, pcomplete-erc-not-ops, pcomplete-erc-nicks)
(pcomplete-erc-all-nicks, pcomplete-erc-channels)
(pcomplete-erc-command-name, pcomplete-erc-parse-arguments):
* lisp/eshell/em-term.el (eshell-visual-command-p):
* lisp/gnus/gnus-cache.el (gnus-cache-fully-p):
* lisp/gnus/nnmail.el (nnmail-get-active)
(nnmail-fancy-expiry-target):
* lisp/mail/mail-utils.el (mail-string-delete):
* lisp/mail/supercite.el (sc-hdr, sc-valid-index-p):
* lisp/net/ange-ftp.el (ange-ftp-use-smart-gateway-p):
* lisp/net/nsm.el (nsm-save-fingerprint-maybe)
(nsm-network-same-subnet, nsm-should-check):
* lisp/net/rcirc.el (rcirc-looking-at-input):
* lisp/net/tramp-cache.el (tramp-get-hash-table):
* lisp/net/tramp-compat.el (tramp-compat-process-running-p):
* lisp/net/tramp-smb.el (tramp-smb-get-share)
(tramp-smb-get-localname, tramp-smb-read-file-entry)
(tramp-smb-get-cifs-capabilities, tramp-smb-get-stat-capability):
* lisp/net/zeroconf.el (zeroconf-list-service-names)
(zeroconf-list-service-types, zeroconf-list-services)
(zeroconf-get-host, zeroconf-get-domain)
(zeroconf-get-host-domain):
* lisp/nxml/rng-xsd.el (rng-xsd-compile)
(rng-xsd-make-date-time-regexp, rng-xsd-convert-date-time):
* lisp/obsolete/erc-hecomplete.el (erc-hecomplete)
(erc-command-list, erc-complete-at-prompt):
* lisp/org/ob-scheme.el (org-babel-scheme-get-buffer-impl):
* lisp/org/ob-shell.el (org-babel--variable-assignments:sh-generic)
(org-babel--variable-assignments:bash_array)
(org-babel--variable-assignments:bash_assoc)
(org-babel--variable-assignments:bash):
* lisp/org/org-clock.el (org-day-of-week):
* lisp/progmodes/cperl-mode.el (cperl-char-ends-sub-keyword-p):
* lisp/progmodes/gud.el (gud-find-c-expr, gud-innermost-expr)
(gud-prev-expr, gud-next-expr):
* lisp/textmodes/table.el (table--at-cell-p, table--probe-cell)
(table--get-cell-justify-property)
(table--get-cell-valign-property)
(table--put-cell-justify-property)
(table--put-cell-valign-property): Fix typos.
* lisp/so-long.el (fboundp): Doc fix.
(so-long-mode-line-info, so-long-mode)
(so-long--check-header-modes): Fix typos.
* lisp/emulation/viper-mous.el (viper-surrounding-word)
(viper-mouse-click-get-word): Fix typos.
(viper-mouse-click-search-word): Doc fix.
* lisp/erc/erc-backend.el (erc-forward-word, erc-word-at-arg-p)
(erc-bounds-of-word-at-point): Fix typos.
(erc-decode-string-from-target, define-erc-response-handler):
Refill docstring.
* lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): Fix typo.
(erc-dcc-get-host, erc-dcc-auto-mask-p, erc-dcc-get-file):
Doc fixes.
* lisp/erc/erc-networks.el (erc-network-name): Fix typo.
(erc-determine-network): Refill docstring.
* lisp/net/dbus.el (dbus-list-hash-table)
(dbus-string-to-byte-array, dbus-byte-array-to-string)
(dbus-check-event): Fix typos.
(dbus-introspect-get-property): Doc fix.
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler):
Rename ARGS to ARGUMENTS. Doc fix.
(tramp-adb-sh-fix-ls-output, tramp-adb-execute-adb-command)
(tramp-adb-find-test-command): Fix typos.
* lisp/net/tramp.el (tramp-set-completion-function)
(tramp-get-completion-function)
(tramp-completion-dissect-file-name)
(tramp-completion-dissect-file-name1)
(tramp-get-completion-methods, tramp-get-completion-user-host)
(tramp-get-inode, tramp-get-device, tramp-mode-string-to-int)
(tramp-call-process, tramp-call-process-region)
(tramp-process-lines): Fix typos.
(tramp-interrupt-process): Doc fix.
* lisp/org/ob-core.el (org-babel-named-src-block-regexp-for-name)
(org-babel-named-data-regexp-for-name): Doc fix.
(org-babel-src-block-names, org-babel-result-names): Fix typos.
* lisp/progmodes/inf-lisp.el (lisp-input-filter): Doc fix.
(lisp-fn-called-at-pt): Fix typo.
* lisp/progmodes/xref.el (xref-backend-identifier-at-point):
Doc fix.
(xref-backend-identifier-completion-table): Fix typo.
2019-10-20 10:12:27 +00:00
|
|
|
|
this command.
|
|
|
|
|
\n(fn CLICK N)"
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(interactive "e\nP")
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if viper-frame-of-focus ;; to handle clicks in another frame
|
|
|
|
|
(select-frame viper-frame-of-focus))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(if (save-excursion
|
|
|
|
|
(or (not (eq (key-binding viper-mouse-down-search-key-parsed)
|
|
|
|
|
'viper-mouse-catch-frame-switch))
|
|
|
|
|
(not (eq (key-binding viper-mouse-up-search-key-parsed)
|
2019-10-21 19:19:25 +00:00
|
|
|
|
'viper-mouse-click-search-word))))
|
1997-09-05 04:48:58 +00:00
|
|
|
|
() ; do nothing, if binding isn't right or not over text
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(let ((previous-search-string viper-s-string)
|
|
|
|
|
click-word click-count)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if (and
|
|
|
|
|
(viper-multiclick-p)
|
|
|
|
|
;; This trick checks if there is a pending mouse event if so, we use
|
|
|
|
|
;; this latter event and discard the current mouse click If the next
|
|
|
|
|
;; pending event is not a mouse event, we execute the current mouse
|
|
|
|
|
;; event
|
|
|
|
|
(progn
|
Remove most of the XEmacs compat code from viper*.el
* lisp/emulation/viper-cmd.el ()
(viper-insert-state-post-command-sentinel)
(viper-change-state-to-vi, viper-change-state-to-insert)
(viper-change-state-to-emacs, viper-escape-to-state)
(viper-special-read-and-insert-char, viper-toggle-key-action)
(viper-prefix-arg-value, viper-prefix-arg-com)
(viper-digit-argument, viper-command-argument, )
(viper-exec-Yank, viper-repeat, viper-forward-char)
(viper-backward-char, viper-forward-word, viper-forward-Word)
(viper-end-of-word, viper-end-of-Word, viper-backward-word)
(viper-backward-Word, viper-beginning-of-line)
(viper-bol-and-skip-white, viper-goto-eol, viper-goto-col)
(viper-next-line, viper-next-line-at-bol, viper-previous-line)
(viper-previous-line-at-bol, viper-goto-line, )
(viper-repeat-find, viper-repeat-find-opposite)
(viper-window-top, viper-window-middle, viper-window-bottom)
(viper-paren-match, viper-search, viper-buffer-search-enable)
(viper-put-back, viper-Put-back, viper-mark-point)
(viper-cycle-through-mark-ring, viper-goto-mark-subr)
(viper-brac-function, viper-register-to-point)
(viper-submit-report): Remove some XEmacs compat code.
* lisp/emulation/viper-ex.el (viper-get-ex-address-subr)
(viper-handle-!, ex-edit, ex-mark, ex-next-related-buffer)
(ex-help, ex-write, ex-write-info, viper-info-on-file): Ditto.
* lisp/emulation/viper-keym.el (viper-add-keymap): Ditto.
* lisp/emulation/viper-macs.el (viper-record-kbd-macro): Remove
XEmacs compat code.
* lisp/emulation/viper-mous.el (viper-mouse-click-insert-word)
(viper-mouse-click-search-word): Remove some XEmacs compat code.
* lisp/emulation/viper-util.el (viper-overlay-p)
(viper-color-defined-p, viper-iconify, viper-memq-char)
(viper-char-equal, viper=, viper-color-display-p)
(viper-get-cursor-color, viper-frame-value)
(viper-change-cursor-color, viper-save-cursor-color)
(viper-restore-cursor-color, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-put-on-search-overlay)
(viper-flash-search-pattern, viper-hide-search-overlay)
(viper-move-replace-overlay, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-hide-replace-overlay)
(viper-replace-start, viper-replace-end)
(viper-set-minibuffer-overlay, viper-check-minibuffer-overlay)
(viper-abbreviate-file-name, viper-mark-marker)
(viper-set-mark-if-necessary, viper-leave-region-active)
(viper-copy-event, viper-read-event-convert-to-char)
(viper-event-key, viper-last-command-char)
(viper-key-to-emacs-key, viper-eventify-list-xemacs)
(viper-set-unread-command-events, viper-char-array-p)
(viper-key-press-events-to-chars, viper-read-char-exclusive):
Remove most of the XEmacs compat code.
* lisp/emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings): Remove some XEmacs compat code.
2019-06-19 22:48:49 +00:00
|
|
|
|
(read-event)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-mouse-event-p last-input-event)))
|
|
|
|
|
(progn ; interrupted wait
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(setq viper-global-prefix-argument (or viper-global-prefix-argument
|
|
|
|
|
arg)
|
|
|
|
|
;; remember command that was before the multiclick
|
2020-03-01 00:42:36 +00:00
|
|
|
|
this-command last-command))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; uninterrupted wait
|
2020-03-01 00:42:36 +00:00
|
|
|
|
(setq click-count (event-click-count click))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq click-word (viper-mouse-click-get-word click nil click-count))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if (> click-count 1)
|
|
|
|
|
(setq arg viper-global-prefix-argument
|
|
|
|
|
viper-global-prefix-argument nil))
|
|
|
|
|
(setq arg (or arg 1))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
Remove most of the XEmacs compat code from viper*.el
* lisp/emulation/viper-cmd.el ()
(viper-insert-state-post-command-sentinel)
(viper-change-state-to-vi, viper-change-state-to-insert)
(viper-change-state-to-emacs, viper-escape-to-state)
(viper-special-read-and-insert-char, viper-toggle-key-action)
(viper-prefix-arg-value, viper-prefix-arg-com)
(viper-digit-argument, viper-command-argument, )
(viper-exec-Yank, viper-repeat, viper-forward-char)
(viper-backward-char, viper-forward-word, viper-forward-Word)
(viper-end-of-word, viper-end-of-Word, viper-backward-word)
(viper-backward-Word, viper-beginning-of-line)
(viper-bol-and-skip-white, viper-goto-eol, viper-goto-col)
(viper-next-line, viper-next-line-at-bol, viper-previous-line)
(viper-previous-line-at-bol, viper-goto-line, )
(viper-repeat-find, viper-repeat-find-opposite)
(viper-window-top, viper-window-middle, viper-window-bottom)
(viper-paren-match, viper-search, viper-buffer-search-enable)
(viper-put-back, viper-Put-back, viper-mark-point)
(viper-cycle-through-mark-ring, viper-goto-mark-subr)
(viper-brac-function, viper-register-to-point)
(viper-submit-report): Remove some XEmacs compat code.
* lisp/emulation/viper-ex.el (viper-get-ex-address-subr)
(viper-handle-!, ex-edit, ex-mark, ex-next-related-buffer)
(ex-help, ex-write, ex-write-info, viper-info-on-file): Ditto.
* lisp/emulation/viper-keym.el (viper-add-keymap): Ditto.
* lisp/emulation/viper-macs.el (viper-record-kbd-macro): Remove
XEmacs compat code.
* lisp/emulation/viper-mous.el (viper-mouse-click-insert-word)
(viper-mouse-click-search-word): Remove some XEmacs compat code.
* lisp/emulation/viper-util.el (viper-overlay-p)
(viper-color-defined-p, viper-iconify, viper-memq-char)
(viper-char-equal, viper=, viper-color-display-p)
(viper-get-cursor-color, viper-frame-value)
(viper-change-cursor-color, viper-save-cursor-color)
(viper-restore-cursor-color, viper-get-visible-buffer-window)
(viper-file-checked-in-p, viper-put-on-search-overlay)
(viper-flash-search-pattern, viper-hide-search-overlay)
(viper-move-replace-overlay, viper-set-replace-overlay)
(viper-set-replace-overlay-glyphs, viper-hide-replace-overlay)
(viper-replace-start, viper-replace-end)
(viper-set-minibuffer-overlay, viper-check-minibuffer-overlay)
(viper-abbreviate-file-name, viper-mark-marker)
(viper-set-mark-if-necessary, viper-leave-region-active)
(viper-copy-event, viper-read-event-convert-to-char)
(viper-event-key, viper-last-command-char)
(viper-key-to-emacs-key, viper-eventify-list-xemacs)
(viper-set-unread-command-events, viper-char-array-p)
(viper-key-press-events-to-chars, viper-read-char-exclusive):
Remove most of the XEmacs compat code.
* lisp/emulation/viper.el (viper-go-away, viper-set-hooks)
(viper-non-hook-settings): Remove some XEmacs compat code.
2019-06-19 22:48:49 +00:00
|
|
|
|
(deactivate-mark)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if (or (not (string= click-word viper-s-string))
|
|
|
|
|
(not (markerp viper-search-start-marker))
|
|
|
|
|
(not (equal (marker-buffer viper-search-start-marker)
|
|
|
|
|
(current-buffer)))
|
|
|
|
|
(not (eq last-command 'viper-mouse-click-search-word)))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(progn
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq viper-search-start-marker (point-marker)
|
|
|
|
|
viper-local-search-start-marker viper-search-start-marker
|
|
|
|
|
viper-mouse-click-search-noerror t
|
|
|
|
|
viper-mouse-click-search-limit nil)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; make search string known to Viper
|
|
|
|
|
(setq viper-s-string (if viper-re-search
|
|
|
|
|
(regexp-quote click-word)
|
|
|
|
|
click-word))
|
|
|
|
|
(if (not (string= viper-s-string (car viper-search-history)))
|
|
|
|
|
(setq viper-search-history
|
|
|
|
|
(cons viper-s-string viper-search-history)))
|
|
|
|
|
))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(push-mark nil t)
|
|
|
|
|
(while (> arg 0)
|
|
|
|
|
(viper-forward-word 1)
|
|
|
|
|
(condition-case nil
|
|
|
|
|
(progn
|
|
|
|
|
(if (not (search-forward
|
|
|
|
|
click-word viper-mouse-click-search-limit
|
|
|
|
|
viper-mouse-click-search-noerror))
|
|
|
|
|
(progn
|
|
|
|
|
(setq viper-mouse-click-search-noerror nil)
|
|
|
|
|
(setq viper-mouse-click-search-limit
|
|
|
|
|
(save-excursion
|
|
|
|
|
(if (and
|
|
|
|
|
(markerp viper-local-search-start-marker)
|
|
|
|
|
(marker-buffer viper-local-search-start-marker))
|
|
|
|
|
(goto-char viper-local-search-start-marker))
|
|
|
|
|
(viper-line-pos 'end)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(search-forward click-word
|
|
|
|
|
viper-mouse-click-search-limit nil)))
|
|
|
|
|
(goto-char (match-beginning 0))
|
|
|
|
|
(message "Searching for: %s" viper-s-string)
|
|
|
|
|
(if (<= arg 1) ; found the right occurrence of the pattern
|
|
|
|
|
(progn
|
|
|
|
|
(viper-adjust-window)
|
|
|
|
|
(viper-flash-search-pattern)))
|
|
|
|
|
)
|
|
|
|
|
(error (beep 1)
|
|
|
|
|
(if (or (not (string= click-word previous-search-string))
|
|
|
|
|
(not (eq last-command 'viper-mouse-click-search-word)))
|
|
|
|
|
(message "`%s': String not found in %s"
|
|
|
|
|
viper-s-string (buffer-name (current-buffer)))
|
|
|
|
|
(message
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"`%s': Last occurrence in %s. Back to beginning of search"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
click-word (buffer-name (current-buffer)))
|
|
|
|
|
(setq arg 1) ;; to terminate the loop
|
|
|
|
|
(sit-for 2))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(setq viper-mouse-click-search-noerror t)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq viper-mouse-click-search-limit nil)
|
|
|
|
|
(if (and (markerp viper-local-search-start-marker)
|
|
|
|
|
(marker-buffer viper-local-search-start-marker))
|
|
|
|
|
(goto-char viper-local-search-start-marker))))
|
|
|
|
|
(setq arg (1- arg)))
|
|
|
|
|
))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2021-03-06 18:03:12 +00:00
|
|
|
|
(defun viper-mouse-catch-frame-switch (_event arg)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
"Catch the event of switching frame.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
Usually is bound to a `down-mouse' event to work properly. See sample
|
1997-06-02 22:50:31 +00:00
|
|
|
|
bindings in the Viper manual."
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(interactive "e\nP")
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq viper-frame-of-focus nil)
|
|
|
|
|
;; pass prefix arg along to viper-mouse-click-search/insert-word
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(setq prefix-arg arg)
|
|
|
|
|
(if (eq last-command 'handle-switch-frame)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq viper-frame-of-focus viper-current-frame-saved))
|
|
|
|
|
;; make Emacs forget that it executed viper-mouse-catch-frame-switch
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(setq this-command last-command))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Called just before switching frames. Saves the old selected frame.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; Sets last-command to handle-switch-frame (this is done automatically in
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; Emacs.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; The semantics of switching frames is different in Emacs and XEmacs.
|
|
|
|
|
;; In Emacs, if you select-frame A while mouse is over frame B and then
|
|
|
|
|
;; start typing, input goes to frame B, which becomes selected.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; In XEmacs, input will go to frame A. This may be a bug in one of the
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; Emacsen, but also may be a design decision.
|
|
|
|
|
;; Also, in Emacs sending input to frame B generates handle-switch-frame
|
|
|
|
|
;; event, while in XEmacs it doesn't.
|
|
|
|
|
;; All this accounts for the difference in the behavior of
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-mouse-click-* commands when you click in a frame other than the one
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; that was the last to receive input. In Emacs, focus will be in frame A
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; until you do something other than viper-mouse-click-* command.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; In XEmacs, you have to manually select frame B (with the mouse click) in
|
|
|
|
|
;; order to shift focus to frame B.
|
2021-03-06 18:03:12 +00:00
|
|
|
|
(defun viper-remember-current-frame (&rest _)
|
|
|
|
|
"Remember the selected frame before the switch-frame event."
|
|
|
|
|
(setq last-command #'handle-switch-frame
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-current-frame-saved (selected-frame)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; The key is of the form (MODIFIER ... BUTTON-NUMBER)
|
|
|
|
|
;; Converts into a valid mouse button spec for the appropriate version of
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Emacs. EVENT-TYPE is either `up' or `down'. Up returns button-up key; down
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; returns button-down key.
|
|
|
|
|
(defun viper-parse-mouse-key (key-var event-type)
|
2021-03-06 18:03:12 +00:00
|
|
|
|
(let ((key (symbol-value key-var))
|
|
|
|
|
button-spec meta-spec shift-spec control-spec)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if (null key)
|
|
|
|
|
;; just return nil
|
|
|
|
|
()
|
|
|
|
|
(setq button-spec
|
|
|
|
|
(cond ((memq 1 key)
|
2019-10-04 12:29:58 +00:00
|
|
|
|
(if (eq 'up event-type)
|
|
|
|
|
"mouse-1" "down-mouse-1"))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
((memq 2 key)
|
2019-10-04 12:29:58 +00:00
|
|
|
|
(if (eq 'up event-type)
|
|
|
|
|
"mouse-2" "down-mouse-2"))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
((memq 3 key)
|
2019-10-04 12:29:58 +00:00
|
|
|
|
(if (eq 'up event-type)
|
|
|
|
|
"mouse-3" "down-mouse-3"))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(t (error
|
|
|
|
|
"%S: invalid button number, %S" key-var key)))
|
|
|
|
|
meta-spec
|
2019-10-04 12:29:58 +00:00
|
|
|
|
(if (memq 'meta key) "M-" "")
|
1997-08-02 07:40:22 +00:00
|
|
|
|
shift-spec
|
2019-10-04 12:29:58 +00:00
|
|
|
|
(if (memq 'shift key) "S-" "")
|
1997-08-02 07:40:22 +00:00
|
|
|
|
control-spec
|
2019-10-04 12:29:58 +00:00
|
|
|
|
(if (memq 'control key) "C-" ""))
|
|
|
|
|
|
2021-03-06 18:03:12 +00:00
|
|
|
|
(vector
|
|
|
|
|
(intern (concat control-spec meta-spec
|
|
|
|
|
shift-spec button-spec))))))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
|
|
|
|
|
(defun viper-unbind-mouse-search-key ()
|
|
|
|
|
(if viper-mouse-up-search-key-parsed
|
|
|
|
|
(global-unset-key viper-mouse-up-search-key-parsed))
|
|
|
|
|
(if viper-mouse-down-search-key-parsed
|
|
|
|
|
(global-unset-key viper-mouse-down-search-key-parsed))
|
|
|
|
|
(setq viper-mouse-up-search-key-parsed nil
|
|
|
|
|
viper-mouse-down-search-key-parsed nil))
|
|
|
|
|
|
|
|
|
|
(defun viper-unbind-mouse-insert-key ()
|
|
|
|
|
(if viper-mouse-up-insert-key-parsed
|
|
|
|
|
(global-unset-key viper-mouse-up-insert-key-parsed))
|
|
|
|
|
(if viper-mouse-down-insert-key-parsed
|
|
|
|
|
(global-unset-key viper-mouse-down-insert-key-parsed))
|
|
|
|
|
(setq viper-mouse-up-insert-key-parsed nil
|
|
|
|
|
viper-mouse-down-insert-key-parsed nil))
|
|
|
|
|
|
|
|
|
|
;; If FORCE, bind even if this mouse action is already bound to something else
|
|
|
|
|
(defun viper-bind-mouse-search-key (&optional force)
|
|
|
|
|
(setq viper-mouse-up-search-key-parsed
|
|
|
|
|
(viper-parse-mouse-key 'viper-mouse-search-key 'up)
|
|
|
|
|
viper-mouse-down-search-key-parsed
|
|
|
|
|
(viper-parse-mouse-key 'viper-mouse-search-key 'down))
|
2021-03-06 18:03:12 +00:00
|
|
|
|
(cond ((not (and viper-mouse-up-search-key-parsed
|
|
|
|
|
viper-mouse-down-search-key-parsed))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
nil) ; just quit
|
2003-02-04 13:24:35 +00:00
|
|
|
|
((and (null force)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(key-binding viper-mouse-up-search-key-parsed)
|
|
|
|
|
(not (eq (key-binding viper-mouse-up-search-key-parsed)
|
|
|
|
|
'viper-mouse-click-search-word)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(message
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"%S already bound to a mouse event. Viper mouse-search feature disabled"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-mouse-up-search-key-parsed))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
((and (null force)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(key-binding viper-mouse-down-search-key-parsed)
|
|
|
|
|
(not (eq (key-binding viper-mouse-down-search-key-parsed)
|
|
|
|
|
'viper-mouse-catch-frame-switch)))
|
|
|
|
|
(message
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"%S already bound to a mouse event. Viper mouse-search feature disabled"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-mouse-down-search-key-parsed))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(t
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(global-set-key viper-mouse-up-search-key-parsed
|
2021-03-06 18:03:12 +00:00
|
|
|
|
#'viper-mouse-click-search-word)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(global-set-key viper-mouse-down-search-key-parsed
|
2021-03-06 18:03:12 +00:00
|
|
|
|
#'viper-mouse-catch-frame-switch))))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
|
|
|
|
|
;; If FORCE, bind even if this mouse action is already bound to something else
|
|
|
|
|
(defun viper-bind-mouse-insert-key (&optional force)
|
|
|
|
|
(setq viper-mouse-up-insert-key-parsed
|
|
|
|
|
(viper-parse-mouse-key 'viper-mouse-insert-key 'up)
|
|
|
|
|
viper-mouse-down-insert-key-parsed
|
|
|
|
|
(viper-parse-mouse-key 'viper-mouse-insert-key 'down))
|
2021-03-06 18:03:12 +00:00
|
|
|
|
(cond ((not (and viper-mouse-up-insert-key-parsed
|
|
|
|
|
viper-mouse-down-insert-key-parsed))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
nil) ; just quit
|
|
|
|
|
((and (null force)
|
|
|
|
|
(key-binding viper-mouse-up-insert-key-parsed)
|
|
|
|
|
(not (eq (key-binding viper-mouse-up-insert-key-parsed)
|
|
|
|
|
'viper-mouse-click-insert-word)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(message
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"%S already bound to a mouse event. Viper mouse-insert feature disabled"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-mouse-up-insert-key-parsed))
|
|
|
|
|
((and (null force)
|
|
|
|
|
(key-binding viper-mouse-down-insert-key-parsed)
|
|
|
|
|
(not (eq (key-binding viper-mouse-down-insert-key-parsed)
|
|
|
|
|
'viper-mouse-catch-frame-switch)))
|
|
|
|
|
(message
|
1999-11-01 07:16:15 +00:00
|
|
|
|
"%S already bound to a mouse event. Viper mouse-insert feature disabled"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-mouse-down-insert-key-parsed))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(t
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(global-set-key viper-mouse-up-insert-key-parsed
|
2021-03-06 18:03:12 +00:00
|
|
|
|
#'viper-mouse-click-insert-word)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(global-set-key viper-mouse-down-insert-key-parsed
|
2021-03-06 18:03:12 +00:00
|
|
|
|
#'viper-mouse-catch-frame-switch))))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
|
|
|
|
|
(defun viper-reset-mouse-search-key (symb val)
|
|
|
|
|
(viper-unbind-mouse-search-key)
|
|
|
|
|
(set symb val)
|
|
|
|
|
(viper-bind-mouse-search-key 'force))
|
|
|
|
|
|
|
|
|
|
(defun viper-reset-mouse-insert-key (symb val)
|
|
|
|
|
(viper-unbind-mouse-insert-key)
|
|
|
|
|
(set symb val)
|
|
|
|
|
(viper-bind-mouse-insert-key 'force))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defcustom viper-mouse-search-key '(meta shift 1)
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"Key used to click-search in Viper.
|
1997-09-13 06:16:07 +00:00
|
|
|
|
This must be a list that specifies the mouse button and modifiers.
|
|
|
|
|
The supported modifiers are `meta', `shift', and `control'.
|
|
|
|
|
For instance, `(meta shift 1)' means that holding the meta and shift
|
|
|
|
|
keys down and clicking on a word with mouse button 1
|
|
|
|
|
will search for that word in the buffer that was current before the click.
|
|
|
|
|
This buffer may be different from the one where the click occurred."
|
1997-09-15 23:21:03 +00:00
|
|
|
|
:type '(list (set :inline t :tag "Modifiers" :format "%t: %v"
|
|
|
|
|
(const :format "%v " meta)
|
|
|
|
|
(const :format "%v " shift)
|
|
|
|
|
(const control))
|
|
|
|
|
(integer :tag "Button"))
|
2021-03-06 18:03:12 +00:00
|
|
|
|
:set #'viper-reset-mouse-search-key)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
|
|
|
|
|
(defcustom viper-mouse-insert-key '(meta shift 2)
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"Key used to click-insert in Viper.
|
1997-09-13 06:16:07 +00:00
|
|
|
|
Must be a list that specifies the mouse button and modifiers.
|
|
|
|
|
The supported modifiers are `meta', `shift', and `control'.
|
|
|
|
|
For instance, `(meta shift 2)' means that holding the meta and shift keys
|
|
|
|
|
down, and clicking on a word with mouse button 2, will insert that word
|
|
|
|
|
at the cursor in the buffer that was current just before the click.
|
|
|
|
|
This buffer may be different from the one where the click occurred."
|
1997-09-15 23:21:03 +00:00
|
|
|
|
:type '(list (set :inline t :tag "Modifiers" :format "%t: %v"
|
|
|
|
|
(const :format "%v " meta)
|
|
|
|
|
(const :format "%v " shift)
|
|
|
|
|
(const control))
|
|
|
|
|
(integer :tag "Button"))
|
2021-03-06 18:03:12 +00:00
|
|
|
|
:set #'viper-reset-mouse-insert-key)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2021-03-06 18:03:12 +00:00
|
|
|
|
(provide 'viper-mous)
|
2001-07-15 19:53:53 +00:00
|
|
|
|
;;; viper-mous.el ends here
|