guile-user
[Top][All Lists]
Advanced

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

Re: [PATCH 1-2/2] Emacsy buffer.scm fixes, opt argument for `switch-to-b


From: Jan Nieuwenhuizen
Subject: Re: [PATCH 1-2/2] Emacsy buffer.scm fixes, opt argument for `switch-to-buffer'
Date: Wed, 26 Jun 2019 14:35:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Amar Singh writes:

> Emacsy's `set-buffer!' does not seem to work

What are you trying to achieve?  Set-buffer! is used eg in with-buffer

--8<---------------cut here---------------start------------->8---
(define-syntax with-buffer
  (syntax-rules ()
    ((with-buffer buffer e ...)
     (let ((old-buffer (current-buffer))
           (result *unspecified*))
       (in-out-guard
        (lambda () (set-buffer! buffer))
        (lambda () e ...)
        (lambda () (set-buffer! old-buffer)))))))
--8<---------------cut here---------------end--------------->8---

and works fine.  You don't want to use it interactively.

> and `switch-to-buffer'
> does a bit more than just switch to the given buffer(it also re-orders
> the buffer-stack).

Yes, it also calls buffer-exit and enter hooks; this is exactly what
Emacs does.

> 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.

I don't think that's what we want, I'm imagining this helps you to
achieve something so I'm curious what you want to do?

> From da20cae843753991422478598da193b5a9f6b35d Mon Sep 17 00:00:00 2001
> From: Amar Singh <address@hidden>
> Date: Mon, 24 Jun 2019 02:22:48 +0530
> Subject: [PATCH 1/2] buffer.scm fixes: other-buffer, next-buffer

LGTM, applied.

> From 1015052f51209adc766d6e1ff4f602c5a0f9f67c Mon Sep 17 00:00:00 2001
> From: Amar Singh <address@hidden>
> Date: Tue, 25 Jun 2019 19:44:08 +0530
> Subject: [PATCH 2/2] buffer.scm: `switch-to-buffer' takes additional argument
>  recall?

Not yet, let's see.

> -        (mru-recall! buffer-stack buffer)
> +        (if recall? (mru-recall! buffer-stack buffer))

(please use `when' for an if without else clause).

janneke

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com



reply via email to

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