org-macs: Fix indentation for full-width characters

* lisp/org-macs.el (org-do-remove-indentation): Handle full-width characters.

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

Reported-by: Yuichiro Hakozaki <sankaku.git@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2019-09/msg00075.html>
This commit is contained in:
Nicolas Goaziou 2019-09-16 18:42:59 +02:00
parent 02f506baf8
commit 55d3dfaaf8

View file

@ -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-indentation)))
(if (zerop ind) (throw :exit nil)
(setq min-ind (min min-ind ind))))))
min-ind))))