[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 79ed878 201/350: Handle formatting to a fake *EBDB
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 79ed878 201/350: Handle formatting to a fake *EBDB* buffer |
Date: |
Mon, 14 Aug 2017 11:46:36 -0400 (EDT) |
branch: externals/ebdb
commit 79ed8786c1b3d714ed14a3c669b6dc2b708d988b
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Handle formatting to a fake *EBDB* buffer
Fixes #26
* ebdb-format.el (ebdb-format-to-tmp-buffer): It's possible for the
user to choose a *EBDB* formatter when formatting to tmp buffer. In
that case, output a buffer containing what the *EBDB* buffer would
have contained, but then remove all properties and put it in text
mode.
---
ebdb-format.el | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/ebdb-format.el b/ebdb-format.el
index 3b064c6..9f7e950 100644
--- a/ebdb-format.el
+++ b/ebdb-format.el
@@ -404,15 +404,33 @@ grouped by field class."
(list (ebdb-prompt-for-formatter)
(ebdb-do-records)))
(let ((buf (get-buffer-create ebdb-format-buffer-name))
- (fmt-coding (slot-value formatter 'coding-system)))
- (with-current-buffer buf
- (erase-buffer)
- (insert (ebdb-fmt-header formatter records))
- (dolist (r records)
- (insert (ebdb-fmt-record formatter r)))
- (insert (ebdb-fmt-footer formatter records))
- (set-buffer-file-coding-system fmt-coding))
- (pop-to-buffer buf)))
+ (fmt-coding (slot-value formatter 'coding-system))
+ (ebdb-p (object-of-class-p formatter 'ebdb-formatter-ebdb)))
+ ;; If the user has chosen an ebdb formatter, we need to
+ ;; special-case it. First because the ebdb formatters handle
+ ;; insertion themselves and the other formatters don't, which was
+ ;; arguably a bad choice. Second because ebdb formatting should
+ ;; behave differently here -- we assume that what the user
+ ;; actually wants is a text-mode buffer containing the text that
+ ;; *would have been* displayed in an *EBDB* buffer, but with all
+ ;; properties removed.
+ (if ebdb-p
+ (save-window-excursion
+ (ebdb-display-records records formatter nil nil nil " *EBDB Fake
Output*")
+ (let ((str (buffer-substring-no-properties
+ (point-min) (point-max))))
+ (with-current-buffer buf
+ (erase-buffer)
+ (insert str))))
+ (with-current-buffer buf
+ (erase-buffer)
+ (insert (ebdb-fmt-header formatter records))
+ (dolist (r records)
+ (insert (ebdb-fmt-record formatter r)))
+ (insert (ebdb-fmt-footer formatter records))
+ (set-buffer-file-coding-system fmt-coding)))
+ (pop-to-buffer buf)
+ (text-mode)))
;;;###autoload
(defun ebdb-format-all-records (&optional formatter)
- [elpa] externals/ebdb 8694194 150/350: Use string-match-p for searching on Org tags, (continued)
- [elpa] externals/ebdb 8694194 150/350: Use string-match-p for searching on Org tags, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e4c0442 162/350: Fix up actions and EBDB buffer menus, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 09e421f 156/350: Rework anniversary/diary integration, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb a8e44ee 175/350: Update company-ebdb for new search behavior, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ece91cb 176/350: Remove spurious ebdb-record-search implementation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 86a3aa9 180/350: Change signature of ebdb-undisplay-records, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 05cf7ec 184/350: New ebdb-message-buffer-name subst, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ae377c1 199/350: Use ebdb-field-search in notes-type record searches, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 54bb078 200/350: Remove final references to ebdb-print, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 072bb74 205/350: ebdb-parse-i18n must also accept a slots argument, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 79ed878 201/350: Handle formatting to a fake *EBDB* buffer,
Eric Abrahamsen <=
- [elpa] externals/ebdb 1ae4bbf 206/350: Provide internationalized ebdb-string and ebdb-parse for phones, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0cb406e 210/350: Expand ebdb-test-save-vars to save ebdb-db-list as well, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 722e2c3 211/350: Mild hack to make pop up windows work well, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 374919e 196/350: Fixes to proper name formatting, part III, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0ccfc0a 215/350: Write generics for ebdb-db-add/remove-record, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 498a580 214/350: Allow user transformation of search strings, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 760fd91 204/350: More informative warning when deleting record fields, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 762f027 219/350: Add Makefile, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 325426e 207/350: Add ebdb-complete.el (#32), Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ea13778 221/350: Autoload calendar-absolute-from-gregorian, Eric Abrahamsen, 2017/08/14