Skip to content

Commit 37a9f04

Browse files
author
vitalie
committed
[Fix polymode#350] Make sure pm--base-buffer-name has no leading spaces
1 parent 14b3abc commit 37a9f04

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

polymode-classes.el

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ instantiated from this class or a subclass of this class.")
218218
:documentation
219219
"Emacs major mode for the chunk's body.
220220
If :mode slot is nil (anonymous chunkmodes), use the value of
221-
`polymode-default-inner-mode' is when set, or use the value of
221+
`polymode-default-inner-mode' when set, or use the value of
222222
the slot :fallback-mode. A special value 'host means to use the
223-
host mode (useful auto-chunkmodes only).")
223+
host mode (useful for `pm-inner-auto-chunkmode' only).")
224224
(fallback-mode
225225
:initarg :fallback-mode
226226
:initform 'poly-fallback-mode
@@ -335,11 +335,12 @@ is of this chunkmode.")
335335
:type symbol
336336
:custom symbol
337337
:documentation
338-
"Major mode to keep in when polymode switches implementation buffers.
339-
When a special symbol 'host, keep in hostmode. The buffer with
340-
this major mode must be installed by one of the innermodes or the
341-
hostmode. If multiple innermodes installed buffers of this mode,
342-
the first buffer is used.")
338+
"Major mode to keep the chunk when the point is inside the chunk.
339+
When a special symbol 'host, keep in hostmode. This is useful when you
340+
want the inner mode to be responsible for font-locking but the host mode
341+
for the edditing capabilities. The buffer with this major mode must be
342+
installed by one of the innermodes or the hostmode. If multiple
343+
innermodes installed buffers of this mode, the first buffer is used.")
343344

344345
(-buffer
345346
:type (or null buffer)

polymode-core.el

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,16 +1455,17 @@ are triggered if present."
14551455
"Run after-save-hooks in indirect buffers.
14561456
Only those in `polymode-run-these-after-save-functions-in-other-buffers'
14571457
are triggered if present."
1458-
(unless (equal (buffer-name) pm--base-buffer-name)
1459-
(let ((cbuf (current-buffer)))
1460-
;; Ensure we are in the base-buffer by accident
1461-
(cl-assert (eq (buffer-base-buffer) nil))
1462-
(setq pm--base-buffer-name (buffer-name))
1463-
;; Rename indirect buffers (#346)
1464-
(dolist (buf (eieio-oref pm/polymode '-buffers))
1465-
(unless (eq buf cbuf)
1466-
(with-current-buffer buf
1467-
(rename-buffer (pm--buffer-name (not (get-buffer-window buf 'visible)))))))))
1458+
(let ((new-name (replace-regexp-in-string "^ +" "" (buffer-name))))
1459+
(unless (equal new-name pm--base-buffer-name)
1460+
(let ((cbuf (current-buffer)))
1461+
;; Ensure we are in the base-buffer
1462+
(cl-assert (eq (buffer-base-buffer) nil))
1463+
(setq pm--base-buffer-name new-name)
1464+
;; Rename indirect buffers (#346)
1465+
(dolist (buf (eieio-oref pm/polymode '-buffers))
1466+
(unless (eq buf cbuf)
1467+
(with-current-buffer buf
1468+
(rename-buffer (pm--buffer-name (not (get-buffer-window buf 'visible))))))))))
14681469
(pm--run-hooks-in-other-buffers
14691470
polymode-run-these-after-save-functions-in-other-buffers
14701471
'after-save-hook))

0 commit comments

Comments
 (0)