Emacsy's `set-buffer!' does not seem to work, and `switch-to-buffer' does a bit more than just switch to the given buffer(it also re-orders the buffer-stack). Maybe an optional argument to `switch-to-buffer' should be provided if the user also wants to set the current buffer as most recently used in `buffer-stack'. WDYT?
Both, resetting buffer order, and not touching it are useful behaviours.
>From da20cae843753991422478598da193b5a9f6b35d Mon Sep 17 00:00:00 2001 From: Amar Singh <n...@disroot.org> Date: Mon, 24 Jun 2019 02:22:48 +0530 Subject: [PATCH 1/2] buffer.scm fixes: other-buffer, next-buffer --- emacsy/buffer.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacsy/buffer.scm b/emacsy/buffer.scm index b85cec4..356d833 100644 --- a/emacsy/buffer.scm +++ b/emacsy/buffer.scm @@ -206,7 +206,7 @@ ;;. (define-interactive (next-buffer #:optional (incr 1)) - (buffer-next!) + (buffer-next! incr) (switch-to-buffer (mru-ref buffer-stack))) ;;. @@ -227,7 +227,7 @@ ;;. (define-interactive (other-buffer #:optional (count 1)) - (next-buffer count)) + (prev-buffer count)) ;;; This is our primitive procedure for switching buffers. It does not ;;; handle any user interaction. -- 2.22.0
>From 1015052f51209adc766d6e1ff4f602c5a0f9f67c Mon Sep 17 00:00:00 2001 From: Amar Singh <n...@disroot.org> Date: Tue, 25 Jun 2019 19:44:08 +0530 Subject: [PATCH 2/2] buffer.scm: `switch-to-buffer' takes additional argument recall? If `recall?' isn't false then set the `buffer' as most recent buffer. --- emacsy/buffer.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacsy/buffer.scm b/emacsy/buffer.scm index 356d833..4908cd9 100644 --- a/emacsy/buffer.scm +++ b/emacsy/buffer.scm @@ -231,14 +231,14 @@ ;;; This is our primitive procedure for switching buffers. It does not ;;; handle any user interaction. -(define (primitive-switch-to-buffer buffer) +(define* (primitive-switch-to-buffer buffer #:optional recall?) (emacsy-log-debug "Running exit hook for ~a" (current-buffer)) (run-hook (buffer-exit-hook (current-buffer))) (set! last-buffer (current-buffer)) (if (mru-contains? buffer-stack buffer) (begin (emacsy-log-debug "Recall buffer ~a" buffer) - (mru-recall! buffer-stack buffer) + (if recall? (mru-recall! buffer-stack buffer)) (set! aux-buffer #f)) (begin (emacsy-log-debug "Set buffer to ~a" buffer) -- 2.22.0