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

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

[elpa] externals/other-frame-window a5ef264 13/16: Minor improvements in


From: Stefan Monnier
Subject: [elpa] externals/other-frame-window a5ef264 13/16: Minor improvements in other-frame-window
Date: Tue, 1 Dec 2020 16:38:35 -0500 (EST)

branch: externals/other-frame-window
commit a5ef264deebd8f81a6a6d136f5f14d2c978ca113
Author: Stephen Leake <stephen_leake@stephe-leake.org>
Commit: Stephen Leake <stephen_leake@stephe-leake.org>

    Minor improvements in other-frame-window
    
    * packages/other-frame-window/other-frame-window.el: Bump version.
    (ofw--echo-keystrokes): Check structure of
    'display-buffer-overriding-action' before accessing.
    (other-frame-window-mode): Doc setting display-buffer-overriding-action
    in init file.
---
 other-frame-window.el | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/other-frame-window.el b/other-frame-window.el
index 47729da..dfa40e6 100644
--- a/other-frame-window.el
+++ b/other-frame-window.el
@@ -1,11 +1,11 @@
 ;;; other-frame-window.el --- Minor mode to enable global prefix keys for 
other frame/window buffer placement  -*- lexical-binding: t -*-
 ;;
-;; Copyright (C) 2015, 2017  Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2017, 2018  Free Software Foundation, Inc.
 ;;
 ;; Author: Stephen Leake <stephen_leake@member.fsf.org>
 ;; Maintainer: Stephen Leake <stephen_leake@member.fsf.org>
 ;; Keywords: frame window
-;; Version: 1.0.4
+;; Version: 1.0.5
 ;; Package-Requires: ((emacs "24.4"))
 ;;
 ;; This file is part of GNU Emacs.
@@ -61,6 +61,14 @@
 ;; r - find-file-read-only in another window/frame.
 ;;
 ;; To extend this list, add key bindings to ‘ofw-transient-map’.
+;;
+;; Some code in Emacs uses an explicit list of actions in a call to
+;; display-buffer, which can defeat the purpose of
+;; other-frame-window. To override that, add:
+;;
+;; (setq display-buffer-overriding-action (cons (list 
'display-buffer-same-window) nil))
+;;
+;; to your Emacs init file.
 
 ;;;; Usage:
 ;;
@@ -137,10 +145,14 @@
     (set-transient-map ofw-transient-map)))
 
 (defun ofw--echo-keystrokes ()
-  (let ((funs (car display-buffer-overriding-action)))
-    (cond
-     ((memq #'ofw-display-buffer-other-frame funs) "[other-frame]")
-     ((memq #'ofw-display-buffer-other-window funs) "[other-window]"))))
+  ;; Sometimes people abuse ‘display-buffer-overriding-action’, and
+  ;; that crashes emacs, so be careful.
+  (when (and (consp display-buffer-overriding-action)
+            (listp (car display-buffer-overriding-action)))
+    (let ((funs (car display-buffer-overriding-action)))
+      (cond
+       ((memq #'ofw-display-buffer-other-frame funs) "[other-frame]")
+       ((memq #'ofw-display-buffer-other-window funs) "[other-window]")))))
 
 (when (boundp 'prefix-command-echo-keystrokes-functions)
   (add-hook 'prefix-command-echo-keystrokes-functions
@@ -298,6 +310,13 @@ o - select another window/frame.
 r - find-file-read-only in another window/frame.
 
 To extend this list, add key bindings to ‘ofw-transient-map’.
+
+To override default Emacs behavior in the absence of a prefix, do:
+
+\(setq display-buffer-overriding-action
+  (cons (list 'display-buffer-same-window) nil))
+
+in your init file.
 "
   :global t
 



reply via email to

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