From dc31135287a8d9945ad30313d010a0a93a61a9fa Mon Sep 17 00:00:00 2001 From: zk_phi Date: Thu, 19 Jun 2014 12:12:46 +0900 Subject: [PATCH] add spray-set-margins --- spray.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/spray.el b/spray.el index 361e049..77bff8e 100644 --- a/spray.el +++ b/spray.el @@ -18,7 +18,7 @@ ;; Author: zk_phi ;; URL: http://hins11.yu-yake.com/ -;; Version: 0.0.0 +;; Version: 0.0.1 ;;; Commentary: @@ -36,6 +36,7 @@ ;;; Change Log: ;; 0.0.0 test release +;; 0.0.1 add spray-set-margins ;;; Code: @@ -71,6 +72,7 @@ ;; * internal vars +(defvar spray--margin-string "") (defvar spray--base-overlay nil) (defvar spray--orp-overlay nil) (defvar spray--running nil) @@ -79,6 +81,14 @@ (defvar spray--saved-buffer-face nil) (defvar spray--saved-restriction nil) +;; * utility functions + +(defun spray-set-margins (left above) + "add margins before/above the spray text. each arguments can be +an integer or a float value." + (setq spray--margin-string + (propertize " " 'display `((space-width ,left) (height ,(1+ above)))))) + ;; * the mode ;;;###autoload @@ -143,8 +153,9 @@ (t 0)))) (move-overlay spray--orp-overlay (1- orp) orp) (move-overlay spray--base-overlay beg end) - (overlay-put spray--base-overlay - 'before-string (make-string (- 5 (- orp beg)) ?\s)) + (overlay-put spray--base-overlay 'before-string + (concat spray--margin-string + (make-string (- 5 (- orp beg)) ?\s))) (narrow-to-region beg end))) (defun spray--update () -- 2.30.2