[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idle-highlight-mode 7401286a4b 01/59: Version 1.0. Initial
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idle-highlight-mode 7401286a4b 01/59: Version 1.0. Initial Commit. |
Date: |
Thu, 7 Jul 2022 12:00:28 -0400 (EDT) |
branch: elpa/idle-highlight-mode
commit 7401286a4b1bce0029113dc755f6e3adafbd0bdc
Author: Cornelius Mika <cornelius.mika@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Version 1.0. Initial Commit.
---
.elisp-autofmt | 0
idle-highlight.el | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 99 insertions(+)
diff --git a/.elisp-autofmt b/.elisp-autofmt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/idle-highlight.el b/idle-highlight.el
new file mode 100755
index 0000000000..9cdd700db8
--- /dev/null
+++ b/idle-highlight.el
@@ -0,0 +1,99 @@
+;;; idle-highlight.el --- highlight the word the point is on
+
+;; Copyright (C) 2008 Phil Hagelberg
+
+;; Author: Phil Hagelberg <technomancy@gmail.com>
+;; URL: http://www.emacswiki.org/cgi-bin/wiki/IdleHighlight
+;; Version: 1.0
+;; Created: 2008-05-13
+;; Keywords: convenience
+;; EmacsWiki: IdleHighlight
+
+;; This file is NOT part of GNU Emacs.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; This program 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
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; Based on some snippets by fledermaus from the #emacs channel.
+
+;; M-x idle-highlight sets an idle timer that highlights all
+;; occurences in the buffer of the word under the point.
+
+;; Enabling it in a hook is recommended. But you don't want it enabled
+;; for all buffers, just programming ones.
+;;
+;; Example:
+;;
+;; (defun my-coding-hook ()
+;; (make-local-variable 'column-number-mode)
+;; (column-number-mode t)
+;; (if window-system (hl-line-mode t))
+;; (idle-highlight))
+;;
+;; (add-hook 'emacs-lisp-mode-hook 'my-coding-hook)
+;; (add-hook 'ruby-mode-hook 'my-coding-hook)
+;; (add-hook 'js2-mode-hook 'my-coding-hook)
+
+;;; Code:
+
+(require 'thingatpt)
+
+
+(defgroup idle-highlight nil "Highlight other occurrences of the word at
point." :group 'faces)
+
+(defface idle-highlight
+ '((t (:inherit region)))
+ "Face used to highlight other occurrences of the word at point."
+ :group 'idle-highlight)
+
+(defvar idle-highlight-last-word nil "Last word to be idle-highlighted.")
+
+(defvar idle-highlight-timer nil "Timer to activate re-highlighting.")
+
+(defun idle-highlight-word-at-point ()
+ "Highlight the word under the point."
+ (let*
+ (
+ (target-symbol (symbol-at-point))
+ (target (symbol-name target-symbol)))
+ (when idle-highlight-last-word
+ (unhighlight-regexp (concat "\\<" (regexp-quote
idle-highlight-last-word) "\\>")))
+ (when
+ (and
+ idle-highlight-timer target target-symbol
+ ;; TODO: no need to highlight keywords like if
+ (not (in-string-p)) (not (equal target "end")))
+ (highlight-regexp (concat "\\<" (regexp-quote target) "\\>")
'idle-highlight)
+ (setq idle-highlight-last-word target))))
+
+;;;###autoload
+(defun idle-highlight (&optional arg)
+ "Toggle idle-highlighting."
+ (interactive "P")
+ (if (and (boundp 'idle-highlight-timer) idle-highlight-timer)
+ (progn
+ (cancel-timer idle-highlight-timer)
+ (setq idle-highlight-timer nil))
+ (set (make-local-variable 'idle-highlight-last-word) nil)
+ (set
+ (make-local-variable 'idle-highlight-timer)
+ (run-with-idle-timer 0.5 :repeat 'idle-highlight-word-at-point))))
+
+(provide 'idle-highlight)
+;;; idle-highlight.el ends here
- [nongnu] elpa/idle-highlight-mode 1e0b38c09f 02/59: [Refactor] Save the last highlighted regexp in a variable for easier unhighlighting., (continued)
- [nongnu] elpa/idle-highlight-mode 1e0b38c09f 02/59: [Refactor] Save the last highlighted regexp in a variable for easier unhighlighting., ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 64d6522636 10/59: Fix documentation, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 902df81b5a 18/59: Cleanup: deprecation warning using `in-string-p`, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode c4be332ecb 34/59: readme: move hints into their own section, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode aa4c7a7ada 40/59: readme: update description, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 4714dcafcc 36/59: readme: add default values for settings, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 2b627d5d45 24/59: Cleanup: be explicit that this mode isn't global, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 20a0fb798c 27/59: Disable the repeating idle timer when the minor mode isn't active, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 082ce4f5fc 48/59: Fix highlighting visible ranges, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 0423fc2b38 55/59: Fix #2 Substrings of identifiers are highlighted, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 7401286a4b 01/59: Version 1.0. Initial Commit.,
ELPA Syncer <=
- [nongnu] elpa/idle-highlight-mode df7f6a84f5 07/59: Highlight only when point is on a symbol character., ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 834d03af77 08/59: Update version to 1.1.2, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode f360d4e7fe 12/59: [Formatting] Place defcustoms before defvars., ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 10eda41c22 15/59: Cleanup: use '--' separator for private functions and variables, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode fa7a82993e 16/59: Cleanup: use defvar-local, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 14150dde6b 17/59: Cleanup: quiet checkdoc warnings, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 59f5c6ce37 23/59: Add readme, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 2bc509cc28 20/59: Cleanup: byte code compiler warnings, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 93a498516e 19/59: Cleanup: slightly more efficient checks, postpone calling symbol-name, ELPA Syncer, 2022/07/07
- [nongnu] elpa/idle-highlight-mode 8be1b197d6 39/59: Add changelog, ELPA Syncer, 2022/07/07