X-Git-Url: https://iankelling.org/git/?p=visible-mark;a=blobdiff_plain;f=visible-mark.el;h=bf353f2593707f936f648ce5e4945142e06e3d56;hp=557e9c44d1ffc61e4061446c913206f9083cf8df;hb=fd0accc186fd82a2dafb9a9e48b9441b9b8f115a;hpb=8f01d2f1ef31eb4935a72db16bfaaf0ee66a220f diff --git a/visible-mark.el b/visible-mark.el index 557e9c4..bf353f2 100644 --- a/visible-mark.el +++ b/visible-mark.el @@ -2,7 +2,16 @@ ;; Copyright (C) 2014 by Ian Kelling -;; Author: Several people, most recently Ian Kelling +;; Maintainer: Ian Kelling +;; Author: Ian Kelling +;; Author: Yann Hodique +;; Author: MATSUYAMA Tomohiro +;; Author: John Foerch +;; Keywords: marking color faces +;; URL: https://gitlab.com/iankelling/visible-mark +;; Created: 2008-02-21 + +;;; 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 @@ -20,30 +29,29 @@ ;;; Commentary: -;; Minor mode to display custom overlay faces on mark location(s). -;; Can display marks from the mark ring in the normal backward direction -;; in the forward direction. +;; Emacs minor mode to highlight mark(s). +;; +;; Allows setting the number of marks to display, and the faces to display them. ;; ;; Example installation: ;; ;; 1. Put this file in Emacs's load-path ;; -;; 2. add to init file +;; 2. add custom faces to init file ;; (require 'visible-mark) +;; (global-visible-mark-mode 1) ;; or add (visible-mark-mode) to specific hooks +;; +;; 3. Add customizations. The defaults are very minimal. They could also be set +;; via customize. ;; -;; ;; example of customizations. -;; ;; This could be set via M-x customize-group visible-mark +;; (defface visible-mark-active ;; put this before (require 'visible-mark) +;; '((((type tty) (class mono))) +;; (t (:background "magenta"))) "") ;; (setq visible-mark-max 2) -;; (defface my-visible-mark-face-2 -;; `((t (:background "orange" :foreground "black"))) -;; "Face for the mark." -;; :group 'visible-mark) -;; (setq visible-mark-faces `(visible-mark-face1 my-visible-mark-face-2)) +;; (setq visible-mark-faces `(visible-mark-face1 my-visible-mark-face2)) ;; -;; (global-visible-mark-mode +1) ;; -;; -;; Additional useful functions like unpoping the mark are listed +;; Additional useful functions like unpoping the mark are at ;; http://www.emacswiki.org/emacs/MarkCommands ;; and http://www.emacswiki.org/emacs/VisibleMark @@ -90,43 +98,21 @@ (((class color) (background light)) (:background "grey80")) (t (:background "gray"))) - "Face for the active mark." - :group 'visible-mark) - -(defface visible-mark-face1 - '((((type tty) (class mono))) - (t (:background "light salmon"))) - "Example face which can be customized and added to subsequent face lists." - :group 'visible-mark) - -(defface visible-mark-face2 - '((((type tty) (class mono))) - (t (:background "light goldenrod"))) - "Example face which can be customized and added to subsequent face lists." - :group 'visible-mark) - -(defface visible-mark-forward-face1 - '((((type tty) (class mono))) - (t (:background "pale green"))) - "Example face which can be customized and added to subsequent face lists." - :group 'visible-mark) - -(defface visible-mark-forward-face2 - nil - "Placeholder face for customization and addition to subsequent face lists." + "Face for the active mark. To redefine this in your init file, +do it before loading/requiring visible-mark." :group 'visible-mark) - -(defvar visible-mark-overlays nil - "The overlays used in this buffer.") -(make-variable-buffer-local 'visible-mark-overlays) - (defcustom visible-mark-inhibit-trailing-overlay t "If non-nil, inhibit the extension of an overlay at the end of a line to the window margin." :group 'visible-mark :type 'boolean) +(defcustom global-visible-mark-mode-exclude-alist nil + "A list of buffer names to be excluded." + :group 'visible-mark + :type '(repeat regexp)) + (defcustom visible-mark-max 1 "The number of marks in the backward direction to be visible." @@ -150,10 +136,40 @@ the last defined face will be reused." :group 'visible-mark :type '(repeat face)) -(defcustom global-visible-mark-mode-exclude-alist nil - "A list of buffer names to be excluded." - :group 'visible-mark - :type '(repeat regexp)) + +;;; example faces + +(defface visible-mark-face1 + '((((type tty) (class mono))) + (t (:background "light salmon"))) + "Example face which can be customized and added to subsequent face lists." + :group 'visible-mark) + +(defface visible-mark-face2 + '((((type tty) (class mono))) + (t (:background "light goldenrod"))) + "Example face which can be customized and added to subsequent face lists." + :group 'visible-mark) + +(defface visible-mark-forward-face1 + '((((type tty) (class mono))) + (t (:background "pale green"))) + "Example face which can be customized and added to subsequent face lists." + :group 'visible-mark) + +(defface visible-mark-forward-face2 + nil + "Placeholder face for customization and addition to subsequent face lists." + :group 'visible-mark) + + + + +(defvar visible-mark-overlays nil + "The overlays used for mark faces. Used internally by visible-mark-mode.") +(make-variable-buffer-local 'visible-mark-overlays) + + (defun visible-mark-initialize-overlays () (mapc @@ -227,6 +243,7 @@ the last defined face will be reused." (t t)) (visible-mark-mode t))) +;;;###autoload (define-minor-mode visible-mark-mode "A mode to make the mark visible." nil nil nil @@ -239,6 +256,7 @@ the last defined face will be reused." (setq visible-mark-overlays nil) (remove-hook 'post-command-hook 'visible-mark-move-overlays t))) +;;;###autoload (define-global-minor-mode global-visible-mark-mode visible-mark-mode visible-mark-mode-maybe :group 'visible-mark)