tecosaur / screenshot

Mirror of https://git.tecosaur.net/tec/screenshot.el
GNU General Public License v3.0
228 stars 14 forks source link

update make-indirect-buffer to have right num of args #18

Closed ChanderG closed 9 months ago

ChanderG commented 9 months ago

I am on Emacs 27.2 and had to make this change to get it working. I assume make-indirect-buffer is a core function, so this discrepancy is a bit surprising...

Great package btw.

tecosaur commented 9 months ago

The forth argument is optional, INHIBIT-BUFFER-HOOKS. In what way wasn't it working without the fourth argument for you?

ChanderG commented 9 months ago

Hmm, from my Emacs help, there are only 3 args, the 3rd being optional.

make-indirect-buffer is an interactive built-in function in ‘C source
code’.

(make-indirect-buffer BASE-BUFFER NAME &optional CLONE)

  Probably introduced at or before Emacs version 19.29.

Create and return an indirect buffer for buffer BASE-BUFFER, named NAME.
BASE-BUFFER should be a live buffer, or the name of an existing buffer.
NAME should be a string which is not the name of an existing buffer.
Optional argument CLONE non-nil means preserve BASE-BUFFER’s state,
such as major and minor modes, in the indirect buffer.
CLONE nil means the indirect buffer’s state is reset to default values.
tecosaur commented 9 months ago

I see:

(make-indirect-buffer BASE-BUFFER NAME &optional CLONE INHIBIT-BUFFER-HOOKS)

Documentation
Create and return an indirect buffer for buffer BASE-BUFFER, named NAME.

BASE-BUFFER should be a live buffer, or the name of an existing buffer.

NAME should be a string which is not the name of an existing buffer.
Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
such as major and minor modes, in the indirect buffer.

CLONE nil means the indirect buffer's state is reset to default values.

If optional argument INHIBIT-BUFFER-HOOKS is non-nil, the new buffer
does not run the hooks kill-buffer-hook,
kill-buffer-query-functions, and buffer-list-update-hook.
tecosaur commented 9 months ago

So, I'm guessing what's actually needed here is an Emacs version guard.

tecosaur commented 9 months ago

Try 5a1905d2a7304740972bb099e78309a0d6445b1f (just pushed)

ChanderG commented 9 months ago

Works now. Thanks.