emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/fountain-mode 7ace331 02/17: Remove timer page count an


From: Paul Rankin
Subject: [elpa] externals/fountain-mode 7ace331 02/17: Remove timer page count and mode-line alteration
Date: Sun, 19 May 2019 09:55:57 -0400 (EDT)

branch: externals/fountain-mode
commit 7ace331c29f6ce7e2f0f4b3b1a8bcbf20ea961a6
Author: Paul W. Rankin <address@hidden>
Commit: Paul W. Rankin <address@hidden>

    Remove timer page count and mode-line alteration
---
 fountain-mode.el | 58 +++++---------------------------------------------------
 1 file changed, 5 insertions(+), 53 deletions(-)

diff --git a/fountain-mode.el b/fountain-mode.el
index 8b4b549..3a97a81 100644
--- a/fountain-mode.el
+++ b/fountain-mode.el
@@ -1637,60 +1637,12 @@ number."
             (setq current total found t)))
         (cons current total)))))
 
-(defun fountain-count-pages (&optional interactive)
-  "Return the approximate current page of total pages in current buffer.
-
-If called interactively, sets INTERACTIVE as non-nil
-unconditionally and prints a message in the echo area."
-  (interactive "p")
-  (fountain-pages-update-mode-line)
-  (redisplay)
+(defun fountain-count-pages ()
+  "Message the current page of total pages in current buffer.
+n.b. This is an approximate calculation."
+  (interactive)
   (let ((pages (fountain-get-page-count)))
-    (fountain-pages-update-mode-line (car pages) (cdr pages))
-    (when interactive
-      (message "Page %d of %d" (car pages) (cdr pages)))))
-
-(defun fountain-pages-update-mode-line (&optional current total)
-  (setq fountain-page-count-string
-        (if fountain-pages-show-in-mode-line
-            (if (and current total)
-                (format "[%d/%d] " current total)
-              "[-/-] ")
-          nil))
-  (force-mode-line-update))
-
-(defun fountain-count-pages-maybe (&optional force)
-  (when (derived-mode-p 'fountain-mode)
-    (while-no-input
-      (redisplay)
-      (cond (force
-             (fountain-count-pages))
-            ((eq fountain-pages-show-in-mode-line 'timer)
-             (fountain-count-pages))
-            ((and fountain-page-count-string
-                  (not fountain-pages-show-in-mode-line))
-             (fountain-pages-update-mode-line))))))
-
-(defun fountain-init-mode-line ()
-  (let ((tail (cdr (memq 'mode-line-modes mode-line-format))))
-    (setq mode-line-format
-          (append
-           (butlast mode-line-format (length tail))
-           (cons 'fountain-page-count-string tail)))))
-
-(defun fountain-cancel-page-count-timer ()
-  (when (timerp fountain-page-count-timer)
-    (cancel-timer fountain-page-count-timer))
-  (setq fountain-page-count-timer nil))
-
-(defun fountain-restart-page-count-timer ()
-  (fountain-cancel-page-count-timer)
-  (setq fountain-page-count-timer
-        ;; FIXME: `fountain-count-pages-maybe' only operates in the "current"
-        ;; buffer, but that will be the buffer that happens to be current when
-        ;; the timer is run.
-        (run-with-idle-timer fountain-pages-count-delay t
-                             #'fountain-count-pages-maybe)))
+    (message "Page %d of %d" (car pages) (cdr pages))))
 
 
 ;;; Templating



reply via email to

[Prev in Thread] Current Thread [Next in Thread]