From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuichiro Hakozaki Subject: [PATCH] org-macs: Fix indentation for fullwidth characters Date: Sun, 8 Sep 2019 04:08:00 +0900 Message-ID: <20190907190800.15618-1-sankaku.git@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51254) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6g4S-000891-W3 for emacs-orgmode@gnu.org; Sat, 07 Sep 2019 15:08:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i6g4R-00036n-SV for emacs-orgmode@gnu.org; Sat, 07 Sep 2019 15:08:28 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:32978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i6g4R-00033H-K3 for emacs-orgmode@gnu.org; Sat, 07 Sep 2019 15:08:27 -0400 Received: by mail-pf1-x432.google.com with SMTP id q10so6675204pfl.0 for ; Sat, 07 Sep 2019 12:08:27 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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