branch: externals/polymode
commit 37a9f045afbf4f6077e55e7bd7ec6b0cdf8bfa70
Author: vitalie <vitalie.sp...@adyen.com>
Commit: vitalie <vitalie.sp...@adyen.com>

    [Fix #350] Make sure pm--base-buffer-name has no leading spaces
---
 polymode-classes.el | 15 ++++++++-------
 polymode-core.el    | 21 +++++++++++----------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/polymode-classes.el b/polymode-classes.el
index fd83341ac8..c35cc36d70 100644
--- a/polymode-classes.el
+++ b/polymode-classes.el
@@ -218,9 +218,9 @@ instantiated from this class or a subclass of this class.")
     :documentation
     "Emacs major mode for the chunk's body.
 If :mode slot is nil (anonymous chunkmodes), use the value of
-`polymode-default-inner-mode' is when set, or use the value of
+`polymode-default-inner-mode' when set, or use the value of
 the slot :fallback-mode. A special value 'host means to use the
-host mode (useful auto-chunkmodes only).")
+host mode (useful for `pm-inner-auto-chunkmode' only).")
    (fallback-mode
     :initarg :fallback-mode
     :initform 'poly-fallback-mode
@@ -335,11 +335,12 @@ is of this chunkmode.")
     :type symbol
     :custom symbol
     :documentation
-    "Major mode to keep in when polymode switches implementation buffers.
-When a special symbol 'host, keep in hostmode. The buffer with
-this major mode must be installed by one of the innermodes or the
-hostmode. If multiple innermodes installed buffers of this mode,
-the first buffer is used.")
+    "Major mode to keep the chunk when the point is inside the chunk.
+When a special symbol 'host, keep in hostmode. This is useful when you
+want the inner mode to be responsible for font-locking but the host mode
+for the edditing capabilities. The buffer with this major mode must be
+installed by one of the innermodes or the hostmode. If multiple
+innermodes installed buffers of this mode, the first buffer is used.")
 
    (-buffer
     :type (or null buffer)
diff --git a/polymode-core.el b/polymode-core.el
index 5cb3f8ad90..1315c13218 100644
--- a/polymode-core.el
+++ b/polymode-core.el
@@ -1455,16 +1455,17 @@ are triggered if present."
   "Run after-save-hooks in indirect buffers.
 Only those in `polymode-run-these-after-save-functions-in-other-buffers'
 are triggered if present."
-  (unless (equal (buffer-name) pm--base-buffer-name)
-    (let ((cbuf (current-buffer)))
-      ;; Ensure we are in the base-buffer by accident
-      (cl-assert (eq (buffer-base-buffer) nil))
-      (setq pm--base-buffer-name (buffer-name))
-      ;; Rename indirect buffers (#346)
-      (dolist (buf (eieio-oref pm/polymode '-buffers))
-        (unless (eq buf cbuf)
-          (with-current-buffer buf
-            (rename-buffer (pm--buffer-name (not (get-buffer-window buf 
'visible)))))))))
+  (let ((new-name (replace-regexp-in-string "^ +" "" (buffer-name))))
+   (unless (equal new-name pm--base-buffer-name)
+     (let ((cbuf (current-buffer)))
+       ;; Ensure we are in the base-buffer
+       (cl-assert (eq (buffer-base-buffer) nil))
+       (setq pm--base-buffer-name new-name)
+       ;; Rename indirect buffers (#346)
+       (dolist (buf (eieio-oref pm/polymode '-buffers))
+         (unless (eq buf cbuf)
+           (with-current-buffer buf
+             (rename-buffer (pm--buffer-name (not (get-buffer-window buf 
'visible))))))))))
   (pm--run-hooks-in-other-buffers
    polymode-run-these-after-save-functions-in-other-buffers
    'after-save-hook))

Reply via email to