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

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

[elpa] externals/ebdb 470f996 2/3: Add support for atomic windows


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 470f996 2/3: Add support for atomic windows
Date: Thu, 9 Nov 2017 18:12:46 -0500 (EST)

branch: externals/ebdb
commit 470f99608e22421c4d8cb5da48f95ac939f3b931
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Add support for atomic windows
    
    * ebdb-com.el (ebdb-join-atomic-windows): New option governing atomic
      window behavior.
      (ebdb-pop-up-window): Check if we're popping-up from an atomic
      window, and maybe join it.
---
 ebdb-com.el |  68 ++++++++++++++++++++---------
 ebdb.info   | 143 ++++++++++++++++++++++++++++++------------------------------
 ebdb.org    |  18 ++++++--
 ebdb.texi   |  35 ++++++++-------
 4 files changed, 149 insertions(+), 115 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index da56958..b763491 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -64,6 +64,13 @@ and t (strongly dedicated)."
                  (const :tag "EBDB window weakly dedicated" ebdb)
                  (const :tag "EBDB window strongly dedicated" t)))
 
+(defcustom ebdb-join-atomic-windows t
+  "When non-nil, have EBDB buffers join atomic windows.
+Atomic windows are window groups that are treated as single
+windows by other splitting/display code."
+  :group 'ebdb-record-display
+  :type 'boolean)
+
 (defcustom ebdb-fill-field-values 't
   "If t, fill particularly long field values so that they fit
 within the *EBDB* buffer."
@@ -356,7 +363,7 @@ display information."
                                     (ebdb-toggle-records-format
                                      (ebdb-do-records t) current-prefix-arg))))
     km)
-  "Keymap for Insidious Big Brother Database.
+  "Keymap for EBDB.
 This is a child of `special-mode-map'.")
 
 (defun ebdb-current-record (&optional full)
@@ -782,7 +789,7 @@ current buffer."
     (when buf
       (with-current-buffer buf
        (when (eq major-mode 'ebdb-mode)
-         (let (buffer-read-only)
+         (let ((inhibit-read-only t))
            (erase-buffer))
          (setq ebdb-records nil)
          (set-buffer-modified-p nil))))))
@@ -1023,26 +1030,35 @@ displayed records."
 ;;; dedicated windows, and doesn't have very robust error checking.
 (defun ebdb-pop-up-window (buf &optional select pop)
   "Display *EBDB* buffer BUF by popping up a new window.
+If SELECT is non-nil, select the new window after creation.
 
-POP is typically a three-element list of (window split
-horiz/vert), where WINDOW is the window to be split, SPLIT says
-to split it by how much, and HORIZ/VERT says whether to split it
-vertically or horizontally.  If HORIZ/VERT is nil, split the
-longest way.  If SPLIT is nil, split 0.5.
+POP is a list of (window split direction), where \"window\" is
+the window to be split, \"split\" says to split it by how much,
+and \"direction\" is one of the symbols left, right, above or
+below.
 
-If the whole POP argument is nil, just re-use the current
-buffer."
+Any of the three elements can be nil.  If \"window\" is nil, use
+the current window.  If \"direction\" is nil, split either below
+or right, depending on which dimension is longest.  If \"split\"
+is nil, split 0.5.
+
+If the whole POP argument is nil, re-use the current window.
+
+If the option `ebdb-join-atomic-windows' is non-nil, a popped-up
+buffer window will become part of whichever atomic window it was
+popped up from."
   (let* ((buf (get-buffer buf))
         (split-window (car-safe pop))
         (buffer-window (get-buffer-window buf t))
-        (horiz/vert (or (caddr pop)
-                        (if (> (window-total-width split-window)
-                               (window-total-height split-window))
-                            'horiz
-                          'vert)))
+        (direction (or (caddr pop)
+                       (if (> (window-total-width split-window)
+                              (window-total-height split-window))
+                           'right
+                         'below)))
         (size (cond ((null pop)
                      nil)
-                    ((integerp (cadr pop)))
+                    ((integerp (cadr pop))
+                     (cadr pop3))
                     (t
                      (let ((ratio (- 1 (or (cadr pop) 0.5)))
                            (dimension (max (window-total-width split-window)
@@ -1051,8 +1067,8 @@ buffer."
 
     (cond (buffer-window
           ;; It's already visible, re-use it.
-          (or (null select)
-              (select-window buffer-window)))
+          (when select
+            (select-window buffer-window)))
          ((not (or split-window size))
           ;; Not splitting, but buffer isn't visible, just take up
           ;; the whole window.
@@ -1060,10 +1076,20 @@ buffer."
           (setq buffer-window (get-buffer-window buf t)))
          (t
           ;; Otherwise split.
-          (setq buffer-window (split-window split-window size
-                                            (if (eql horiz/vert 'vert)
-                                                'below
-                                              'right)))
+          (setq
+           buffer-window
+           ;;   If the window we're splitting is an atomic window,
+           ;; maybe make our buffer part of the atom.
+           (if (and ebdb-join-atomic-windows
+                    (window-atom-root split-window))
+               (display-buffer-in-atom-window
+                buf `((window . ,split-window)
+                      (side . ,direction)
+                      ,(if (eq direction 'below)
+                           `(window-height . ,size)
+                         `(window-width . ,size))))
+             (split-window
+              split-window size direction)))
           (set-window-buffer buffer-window buf)))
     (display-buffer-record-window 'window buffer-window buf)
     (set-window-prev-buffers buffer-window nil)
diff --git a/ebdb.info b/ebdb.info
index 0d0f1e8..789df2b 100644
--- a/ebdb.info
+++ b/ebdb.info
@@ -60,8 +60,6 @@ Creating Records
 * Record classes::
 * Record names::
 
-
-
 Record Fields
 
 * Inserting New Fields::
@@ -69,22 +67,19 @@ Record Fields
 * Deleting Records and Fields::
 * Field Types::
 
-
-
-
 Field Types
 
 * Role fields::
 * Tag field::
 * Mail folder field::
 
+
 MUA Interaction
 
 * Loading MUA Code::
 * Display and Updating::
 * EBDB and MUA summary buffers::
 
-
 Display and Updating
 
 * Pop-up Buffers::
@@ -98,6 +93,7 @@ EBDB and MUA summary buffers
 * Sender name display::
 * Summary buffer marks::
 
+
 EBDB Buffers
 
 * Searching::
@@ -110,13 +106,6 @@ Searching
 * Changing Search Behavior::
 
 
-
-
-
-
-
-
-
 Hacking EBDB
 
 * Field Classes::
@@ -134,11 +123,12 @@ Field Classes
 * Formatting in the EBDB Buffer::
 
 
-
 Writing Integration For New MUAs
 
 * Article snarfing::
 
+
+
 
 File: ebdb.info,  Node: Getting Started,  Next: The EBDB Database,  Prev: Top, 
 Up: Top
 
@@ -613,10 +603,18 @@ command, or by cloning or renaming existing buffers.
      possible to manually create the buffer using interactive commands
      (see below).
 
-   At present, there are _no_ user customization options controlling the
-size and layout of MUA pop-up buffers: each MUA creates the pop-up
-according to hard-coded rules.  This will likely change in the future:
-please complain to the author.
+   EBDB can also integrate with atomic windows (*Note (elisp)Atomic
+Windows::).
+
+ -- User Option: ebdb-join-atomic-windows
+     When non-nil (the defaul), EBDB buffers that are popped up within
+     existing atomic windows will become part of the atomic buffer.
+     Otherwise they will be opened to one side of the atomic window.
+
+   At present, there are _no_ other user customization options
+controlling the size and layout of MUA pop-up buffers: each MUA creates
+the pop-up according to hard-coded rules.  This will likely change in
+the future: please complain to the author.
 
 
 File: ebdb.info,  Node: Auto-Updating Records,  Next: Noticing and Automatic 
Rules,  Prev: Pop-up Buffers,  Up: Display and Updating
@@ -2047,6 +2045,7 @@ Index
                                                               (line   6)
 * ebdb-insert-field <1>:                 The Basics of ebdb-mode.
                                                               (line  30)
+* ebdb-join-atomic-windows:              Pop-up Buffers.      (line  19)
 * ebdb-mail:                             The Basics of ebdb-mode.
                                                               (line  56)
 * ebdb-make-buffer-name:                 Writing Integration For New MUAs.
@@ -2219,60 +2218,60 @@ Index
 
 Tag Table:
 Node: Top806
-Node: Getting Started2435
-Node: Migration from BBDB3090
-Node: Record Migration3301
-Node: Variables and Options4104
-Node: Migration from Org Contacts4590
-Node: The EBDB Database5350
-Node: Creating Records9338
-Node: Record classes10419
-Node: Record names10764
-Node: Record Fields11439
-Node: Inserting New Fields11683
-Node: Editing Existing Fields12479
-Node: Deleting Records and Fields13079
-Node: Field Types13475
-Node: Role fields15762
-Node: Tag field17450
-Node: Mail folder field18094
-Node: MUA Interaction18422
-Node: Loading MUA Code18946
-Node: Display and Updating19659
-Node: Pop-up Buffers20425
-Node: Auto-Updating Records21263
-Node: Noticing and Automatic Rules23663
-Node: Interactive Commands24996
-Node: EBDB and MUA summary buffers27471
-Node: Sender name display27957
-Node: Summary buffer marks29184
-Node: EBDB Buffers30363
-Node: Searching31545
-Node: Changing Search Behavior33207
-Node: The Basics of ebdb-mode34454
-Node: Marking38055
-Node: Exporting/Formatting38479
-Node: Completion39428
-Node: Snarfing40626
-Node: Internationalization42627
-Node: Diary Integration45326
-Node: Mail Aliases46191
-Node: vCard Support46905
-Node: Org Integration47404
-Node: Citing Records49302
-Node: Hacking EBDB50060
-Node: Field Classes52379
-Node: Init and Delete Methods55510
-Node: The Labeled Field Class57017
-Node: The Singleton Field Class57871
-Node: Actions58309
-Node: Custom Field Searching58981
-Node: Fast Lookups61848
-Node: Formatting in the EBDB Buffer63658
-Node: Writing Internationalization Libraries65734
-Node: Writing Integration For New MUAs70148
-Node: Article snarfing73595
-Node: Index74313
+Node: Getting Started2425
+Node: Migration from BBDB3080
+Node: Record Migration3291
+Node: Variables and Options4094
+Node: Migration from Org Contacts4580
+Node: The EBDB Database5340
+Node: Creating Records9328
+Node: Record classes10409
+Node: Record names10754
+Node: Record Fields11429
+Node: Inserting New Fields11673
+Node: Editing Existing Fields12469
+Node: Deleting Records and Fields13069
+Node: Field Types13465
+Node: Role fields15752
+Node: Tag field17440
+Node: Mail folder field18084
+Node: MUA Interaction18412
+Node: Loading MUA Code18936
+Node: Display and Updating19649
+Node: Pop-up Buffers20415
+Node: Auto-Updating Records21591
+Node: Noticing and Automatic Rules23991
+Node: Interactive Commands25324
+Node: EBDB and MUA summary buffers27799
+Node: Sender name display28285
+Node: Summary buffer marks29512
+Node: EBDB Buffers30691
+Node: Searching31873
+Node: Changing Search Behavior33535
+Node: The Basics of ebdb-mode34782
+Node: Marking38383
+Node: Exporting/Formatting38807
+Node: Completion39756
+Node: Snarfing40954
+Node: Internationalization42955
+Node: Diary Integration45654
+Node: Mail Aliases46519
+Node: vCard Support47233
+Node: Org Integration47732
+Node: Citing Records49630
+Node: Hacking EBDB50388
+Node: Field Classes52707
+Node: Init and Delete Methods55838
+Node: The Labeled Field Class57345
+Node: The Singleton Field Class58199
+Node: Actions58637
+Node: Custom Field Searching59309
+Node: Fast Lookups62176
+Node: Formatting in the EBDB Buffer63986
+Node: Writing Internationalization Libraries66062
+Node: Writing Integration For New MUAs70476
+Node: Article snarfing73923
+Node: Index74641
 
 End Tag Table
 
diff --git a/ebdb.org b/ebdb.org
index ca7279b..6e17556 100644
--- a/ebdb.org
+++ b/ebdb.org
@@ -430,10 +430,20 @@ possible to manually create the buffer using interactive 
commands (see
 below).
 #+end_defopt
 
-At present, there are _no_ user customization options controlling the
-size and layout of MUA pop-up buffers: each MUA creates the pop-up
-according to hard-coded rules.  This will likely change in the future:
-please complain to the author.
+EBDB can also integrate with atomic windows (@@texinfo:@xref{Atomic
+Windows,,,elisp}@@).
+
+#+ATTR_TEXINFO: :options ebdb-join-atomic-windows
+#+begin_defopt
+When non-nil (the defaul), EBDB buffers that are popped up within
+existing atomic windows will become part of the atomic buffer.
+Otherwise they will be opened to one side of the atomic window.
+#+end_defopt
+
+At present, there are _no_ other user customization options
+controlling the size and layout of MUA pop-up buffers: each MUA
+creates the pop-up according to hard-coded rules.  This will likely
+change in the future: please complain to the author.
 *** Auto-Updating Records
 EBDB can automatically update the name and mail addresses of records
 based on information in an MUA message. The first and most important
diff --git a/ebdb.texi b/ebdb.texi
index e63b994..877a0f9 100644
--- a/ebdb.texi
+++ b/ebdb.texi
@@ -83,8 +83,6 @@ Creating Records
 * Record classes::
 * Record names::
 
-
-
 Record Fields
 
 * Inserting New Fields::
@@ -92,22 +90,19 @@ Record Fields
 * Deleting Records and Fields::
 * Field Types::
 
-
-
-
 Field Types
 
 * Role fields::
 * Tag field::
 * Mail folder field::
 
+
 MUA Interaction
 
 * Loading MUA Code::
 * Display and Updating::
 * EBDB and MUA summary buffers::
 
-
 Display and Updating
 
 * Pop-up Buffers::
@@ -121,6 +116,7 @@ EBDB and MUA summary buffers
 * Sender name display::
 * Summary buffer marks::
 
+
 EBDB Buffers
 
 * Searching::
@@ -133,13 +129,6 @@ Searching
 * Changing Search Behavior::
 
 
-
-
-
-
-
-
-
 Hacking EBDB
 
 * Field Classes::
@@ -157,10 +146,11 @@ Field Classes
 * Formatting in the EBDB Buffer::
 
 
-
 Writing Integration For New MUAs
 
 * Article snarfing::
+
+
 @end detailmenu
 @end menu
 
@@ -641,10 +631,19 @@ possible to manually create the buffer using interactive 
commands (see
 below).
 @end defopt
 
-At present, there are _no_ user customization options controlling the
-size and layout of MUA pop-up buffers: each MUA creates the pop-up
-according to hard-coded rules.  This will likely change in the future:
-please complain to the author.
+EBDB can also integrate with atomic windows (@xref{Atomic
+Windows,,,elisp}).
+
address@hidden ebdb-join-atomic-windows
+When non-nil (the defaul), EBDB buffers that are popped up within
+existing atomic windows will become part of the atomic buffer.
+Otherwise they will be opened to one side of the atomic window.
address@hidden defopt
+
+At present, there are _no_ other user customization options
+controlling the size and layout of MUA pop-up buffers: each MUA
+creates the pop-up according to hard-coded rules.  This will likely
+change in the future: please complain to the author.
 
 @node Auto-Updating Records
 @subsection Auto-Updating Records



reply via email to

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