[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/crux de603e9 088/112: Add function other-window-or-switch-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/crux de603e9 088/112: Add function other-window-or-switch-buffer |
Date: |
Wed, 11 Aug 2021 09:57:59 -0400 (EDT) |
branch: elpa/crux
commit de603e953ed382277fd352c1a3a71924548ae7d9
Author: thdox <thdox@free.fr>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Add function other-window-or-switch-buffer
Move to other window if one exists, or switch to most recent buffer.
Source is http://mbork.pl/2017-02-26_other-window-or-switch-buffer.
---
README.md | 1 +
crux.el | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/README.md b/README.md
index 101043e..146962a 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,7 @@ Command |
Suggested Keybinding(s)
`crux-upcase-region` | <kbd>C-x C-u</kbd> |
`upcase-region` when `transient-mark-mode` is on and region is active.
`crux-downcase-region` | <kbd>C-x C-l</kbd> |
`downcase-region` when `transient-mark-mode` is on and region is active.
`crux-capitalize-region` | <kbd>C-x M-c</kbd> |
`capitalize-region` when `transient-mark-mode` is on and region is active.
+`crux-other-window-or-switch-buffer` | <kbd>M-o</kbd> |
Select other window, or switch to most recent buffer if only one windows.
Here's how you'd bind some of the commands to keycombos:
diff --git a/crux.el b/crux.el
index fa9259c..d0a5931 100644
--- a/crux.el
+++ b/crux.el
@@ -621,6 +621,15 @@ Repeated invocations toggle between the two most recently
open buffers."
(switch-to-buffer (other-buffer (current-buffer) 1)))
;;;###autoload
+(defun crux-other-window-or-switch-buffer ()
+ "Call `other-window' if more than one window is visible.
+Switch to most recent buffer otherwise."
+ (interactive)
+ (if (one-window-p)
+ (switch-to-buffer nil)
+ (other-window 1)))
+
+;;;###autoload
(defun crux-kill-other-buffers ()
"Kill all buffers but the current one.
Doesn't mess with special buffers."
- [nongnu] elpa/crux e805ab7 057/112: Use synchronous process for crux-open-with, (continued)
- [nongnu] elpa/crux e805ab7 057/112: Use synchronous process for crux-open-with, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 4f5c8fe 059/112: [Fix #46] Address two issues with crux-move-beginning-line (#48), ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 49dc7d7 067/112: Remove unused prefix argument from crux-smart-kill-line, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 903db7b 080/112: Add history on crux and links to emacsredux blog posts, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux ba4a1f3 098/112: Restructure the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux a0a34d1 100/112: Fix defcustom types, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux acaaa00e 065/112: Bump the copyright years, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux c79985f 077/112: Saner functions for modifying cases on region for humans, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 308f17d 079/112: Bump the copyright years, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux b923d61 082/112: Support creating shells and terminal buffers, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux de603e9 088/112: Add function other-window-or-switch-buffer,
ELPA Syncer <=
- [nongnu] elpa/crux 96d4faa 097/112: Silence byte-compiler warnings, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 501a43c 105/112: Placate byte-compiler, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux d989f2a 110/112: Bump copyright years, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e0457f6 103/112: Fix a major mode check, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e3e16c1 066/112: Add a missing space, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux fa064d7 068/112: Remove a bunch of redundant progn usages, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 3e07035 073/112: Add missing autoloads, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 7365fdc 075/112: Add crux-copy-file-preserve-attribute, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux e67d040 078/112: Allow crux-sudo-edit on remote files, ELPA Syncer, 2021/08/11
- [nongnu] elpa/crux 2a1a39a 083/112: Add a few GitHub templates, ELPA Syncer, 2021/08/11