[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 864c1f3 7/9: Give formatters a post-format-functio
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 864c1f3 7/9: Give formatters a post-format-function slot |
Date: |
Wed, 18 Oct 2017 17:51:58 -0400 (EDT) |
branch: externals/ebdb
commit 864c1f3c82f1f20f6301784956547a0116efcbce
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Give formatters a post-format-function slot
* ebdb-format.el (ebdb-formatter): Essentially a post-format hook,
intended to be used to set a major mode.
(ebdb-format-to-tmp-buffer): Call it.
* ebdb-com.el (ebdb-formatter-ebdb): Set it to #'text-mode for the
ebdb formatter -- it isn't used during normal *EBDB* buffer
formatting.
---
ebdb-com.el | 5 ++++-
ebdb-format.el | 12 ++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index d114014..4e31108 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -389,7 +389,10 @@ If FULL is non-nil record includes the display
information."
;;; *EBDB* formatting
(defclass ebdb-formatter-ebdb (ebdb-formatter)
- nil
+ ;; This post-format-function only comes into play when the user
+ ;; chooses the EBDB format in `ebdb-format-to-tmp-buffer'.
+ ((post-format-function
+ :initform #'text-mode))
:documentation
"Abstract formatter base class for *EBDB* buffer(s)."
:abstract t)
diff --git a/ebdb-format.el b/ebdb-format.el
index 181a58f..0ef16cf 100644
--- a/ebdb-format.el
+++ b/ebdb-format.el
@@ -89,7 +89,13 @@
\"collapsed\". What this means is up to the formatter, but it
generally indicates that most of the field contents will
hidden unless the user takes some action, such as clicking or
- hitting <TAB>. (Currently unimplemented.)"))
+ hitting <TAB>. (Currently unimplemented.)")
+ (post-format-function
+ :type (or null function)
+ :initarg :post-format-function
+ :initform nil
+ :documentation "A function to be called after formatting is
+ complete. Probably a major mode."))
:abstract t
:documentation "Abstract base class for EBDB formatters.
Subclass this to produce real formatters.")
@@ -376,7 +382,9 @@ grouped by field class."
(insert (ebdb-fmt-footer formatter records))
(set-buffer-file-coding-system fmt-coding)))
(pop-to-buffer buf)
- (text-mode)))
+ (let ((f (slot-value formatter 'post-format-function)))
+ (when (fboundp f)
+ (funcall f)))))
;;;###autoload
(defun ebdb-format-all-records (&optional formatter)
- [elpa] externals/ebdb updated (b0029d3 -> aac31a3), Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb e8c956d 1/9: Adjust database checks when loading, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 64dbf86 5/9: Bah, commited a bit of (erroneous) test code, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 94b11b9 2/9: Various tweaks, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb c6aef3b 3/9: Fix parsing of address countries during migration, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 9acc6d4 4/9: Provide more control over faces in *EBDB* buffers, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb dcb1fcc 6/9: Turns out ebdb-fmt-collect-fields could have been a lot simpler, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 864c1f3 7/9: Give formatters a post-format-function slot,
Eric Abrahamsen <=
- [elpa] externals/ebdb aac31a3 9/9: Add browse-url action for domain fields, Eric Abrahamsen, 2017/10/18
- [elpa] externals/ebdb 1ebd9eb 8/9: Fix function call, Eric Abrahamsen, 2017/10/18