* [PATCH] org-macs: Fix indentation for fullwidth characters
@ 2019-09-07 19:08 Yuichiro Hakozaki
2019-09-16 16:50 ` Nicolas Goaziou
0 siblings, 1 reply; 2+ messages in thread
From: Yuichiro Hakozaki @ 2019-09-07 19:08 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Yuichiro Hakozaki
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] org-macs: Fix indentation for fullwidth characters
2019-09-07 19:08 [PATCH] org-macs: Fix indentation for fullwidth characters Yuichiro Hakozaki
@ 2019-09-16 16:50 ` Nicolas Goaziou
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2019-09-16 16:50 UTC (permalink / raw)
To: Yuichiro Hakozaki; +Cc: emacs-orgmode
Hello,
Yuichiro Hakozaki <sankaku.git@gmail.com> writes:
> @@ -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)))))
I used `current-indentation' instead. Thank you for the bug report, and
the patch.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-16 16:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-07 19:08 [PATCH] org-macs: Fix indentation for fullwidth characters Yuichiro Hakozaki
2019-09-16 16:50 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).