emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] org-macs: Fix indentation for fullwidth characters


From: Yuichiro Hakozaki
Subject: [O] [PATCH] org-macs: Fix indentation for fullwidth characters
Date: Sun, 8 Sep 2019 04:08:00 +0900

Hi,

When the least indented line in buffer begins from fullwidth character
like 'あ', a Japanese character, `org-do-remove-indentation' doesn't
remove indentation at all or removes improperly.


e.g. 'あ' with 2 spaces indent

-----[buffer begin]-----
  あ
-----[buffer   end]-----
`org-do-remove-indentation' does nothing in this buffer.

Expected result is:
-----[buffer begin]-----
あ
-----[buffer   end]-----
and this patch allows it.


Regards,

Yuichiro





* lisp/org-macs.el (org-do-remove-indentation): Remove indentation
properly even when the least indented line begins from fullwidth
character.

TINYCHANGE
---
 lisp/org-macs.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index d9c5e8dd1..b5f6be30e 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -335,7 +335,7 @@ if it fails."
                 (let ((min-ind (point-max)))
                   (save-excursion
                     (while (re-search-forward "^[ \t]*\\S-" nil t)
-                      (let ((ind (1- (current-column))))
+                      (let ((ind (- (current-column) (char-width 
(char-before)))))
                         (if (zerop ind) (throw :exit nil)
                           (setq min-ind (min min-ind ind))))))
                   min-ind))))
-- 
2.23.0




reply via email to

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