X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=spray.el;h=7dbd65a583e8ae361729e6e03d2b3cafa2419eee;hb=c52fc16e72693d5acf9df0aa6a26827862a1fe14;hp=a15274f0adb71f2688c785b5967656196ef58521;hpb=dab6e693f506f5d828cccf1da8d0a673613eb980;p=spray diff --git a/spray.el b/spray.el index a15274f..7dbd65a 100644 --- a/spray.el +++ b/spray.el @@ -21,6 +21,7 @@ ;; Created: 18 Jun 2014 ;; Version: 0.0.2 ;; URL: https://github.com/ian-kelling/spray +;; Mailing list: https://lists.iankelling.org/listinfo/spray ;; Keywords: convenience ;;; Commentary: @@ -98,6 +99,12 @@ :group 'spray :type 'integer) +(defcustom spray-save-point nil + "Set to true and then exiting spray mode will restore the point" + :group 'spray + :type 'boolean) + + (defcustom spray-height 400 "Height of characters" :group 'spray @@ -177,6 +184,7 @@ decreasing by one for each subsequent word." (defvar spray--saved-cursor-type nil) (defvar spray--saved-restriction nil) (defvar spray--saved-minor-modes nil) +(defvar spray--saved-point nil) ;; * utility functions @@ -197,6 +205,7 @@ decreasing by one for each subsequent word." (setq spray--base-overlay (make-overlay (point-min) (point-max)) spray--accent-overlay (make-overlay 0 0) spray--saved-cursor-type cursor-type + spray--saved-point (point) spray--saved-restriction (and (buffer-narrowed-p) (cons (point-min) (point-max)))) (dolist (mode spray-unsupported-minor-modes) @@ -221,6 +230,8 @@ decreasing by one for each subsequent word." (cdr spray--saved-restriction)) (widen)) (setq cursor-type spray--saved-cursor-type) + (when (and spray-save-point spray--saved-point) + (goto-char spray--saved-point)) (dolist (mode spray--saved-minor-modes) (funcall mode 1)) (setq spray--saved-minor-modes nil)))) @@ -269,7 +280,7 @@ decreasing by one for each subsequent word." (t (widen) (if (eobp) - (spray-mode -1) + (spray-quit) (when (not (zerop spray--first-words)) (setq spray--initial-delay spray--first-words) (setq spray--first-words (1- spray--first-words)))