branch: elpa/logview
commit 0e323012937302758c2dd049ec2e42f917f51dc6
Author: Paul Pogonyshev <pogonys...@gmail.com>
Commit: Paul Pogonyshev <pogonys...@gmail.com>

    Collect macros and inlined functions at file beginning.
---
 logview.el | 78 +++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 42 insertions(+), 36 deletions(-)

diff --git a/logview.el b/logview.el
index 781d24b3b5..d35ffcf135 100644
--- a/logview.el
+++ b/logview.el
@@ -381,6 +381,48 @@ levels.")
 (make-variable-buffer-local 'logview--process-buffer-changes)
 
 
+
+;;; Macros and inlined functions.
+
+;; Lisp is sensitive to declaration order, so these are collected at
+;; the beginnig of the file.
+
+(defmacro logview--std-matching (&rest body)
+  (declare (indent 0) (debug t))
+  `(save-excursion
+     (let ((case-fold-search nil))
+       ,@body)))
+
+(defmacro logview--std-matching-and-altering (&rest body)
+  (declare (indent 0) (debug t))
+  `(save-excursion
+     (let ((logview--process-buffer-changes nil)
+           (case-fold-search                nil)
+           (inhibit-read-only               t))
+       (with-silent-modifications
+         ,@body))))
+
+
+;; The following (inlined) functions are needed when applying
+;; 'invisible' property.  Generally we count entry from start of its
+;; line to the start of next entry's line.  This works nice e.g. for
+;; highlighting.  However, for hiding entries we need to take linefeed
+;; that _preceeds_ the entry, otherwise ellipses show at line
+;; beginnings, which is ugly and shifts actual buffer text.
+
+(defsubst logview--linefeed-back-checked (position)
+  "Assuming POSITION is at the beginning of a line, return
+position just before the preceding linefeed, if possible."
+  (if (> position 1)
+      (1- position)
+    1))
+
+(defsubst logview--linefeed-back (position)
+  "Assuming POSITION is at the beginning of a non-first line,
+return position just before the preceding linefeed."
+  (1- position))
+
+
 
 ;;; The mode.
 
@@ -1042,22 +1084,6 @@ argument is positive, disable it otherwise."
              (if (> direction 0) "No next (visible) entry" "No previous 
(visible) entry")))))
 
 
-(defmacro logview--std-matching (&rest body)
-  (declare (indent 0) (debug t))
-  `(save-excursion
-     (let ((case-fold-search nil))
-       ,@body)))
-
-(defmacro logview--std-matching-and-altering (&rest body)
-  (declare (indent 0) (debug t))
-  `(save-excursion
-     (let ((logview--process-buffer-changes nil)
-           (case-fold-search                nil)
-           (inhibit-read-only               t))
-       (with-silent-modifications
-         ,@body))))
-
-
 (defun logview--match-current-entry ()
   "Match the header of the log entry where the point currently is.
 
@@ -1284,26 +1310,6 @@ See `logview--iterate-entries-forward' for details."
                              'invisible (cons hider (get-text-property 
after-first-line 'invisible))))))))
 
 
-;; The following (inlined) functions are needed when applying
-;; 'invisible' property.  Generally we count entry from start of its
-;; line to the start of next entry's line.  This works nice e.g. for
-;; highlighting.  However, for hiding entries we need to take linefeed
-;; that _preceeds_ the entry, otherwise ellipses show at line
-;; beginnings, which is ugly and shifts actual buffer text.
-
-(defsubst logview--linefeed-back-checked (position)
-  "Assuming POSITION is at the beginning of a line, return
-position just before the preceding linefeed, if possible."
-  (if (> position 1)
-      (1- position)
-    1))
-
-(defsubst logview--linefeed-back (position)
-  "Assuming POSITION is at the beginning of a non-first line,
-return position just before the preceding linefeed."
-  (1- position))
-
-
 (defun logview--iterate-split-alists (callback &rest alists)
   (let ((seen (make-hash-table :test 'equal)))
     (dolist (alist alists)

Reply via email to