emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Miquel" <sebastien.miquel@posteo.eu>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Source block indentation does not work properly for yaml-mode [9.6.6 ( @ /home/user/.emacs.d/elpa/org-9.6.6/)]
Date: Fri,  7 Jul 2023 13:21:17 +0000	[thread overview]
Message-ID: <685a46ca-07c4-d7ad-e710-b4ae151e43fe@posteo.eu> (raw)
In-Reply-To: <874jmgxd06.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]


Ihor Radchenko writes:
> Sebastien, it looks like one of the tests is failing on the older Emacs:
> https://builds.sr.ht/~bzg/job/1020247

Does this specify anywhere what version of emacs it is using ?

> Most likely, because `current-column' did not take into account 'display
> property until recently.

Here's a workaround. I think I found what emacs commit makes it work,
but I haven't been able to test it with an older emacs version.

-- 
Sébastien Miquel

[-- Attachment #2: 0001-test-org-src.el-Work-around-current-column-bug-in-ol.patch --]
[-- Type: text/x-patch, Size: 1697 bytes --]

From 81b33f16ad2e2b2cff20110ff1dafefbc348f9dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miquel@posteo.eu>
Date: Fri, 7 Jul 2023 13:58:17 +0200
Subject: [PATCH] test-org-src.el: Work around `current-column' bug in older
 emacs

* testing/lisp/test-org-src.el (test-org-src/indented-blocks): Work
around `current-column' not working in the presence of display strings
in older emacs.
---
 testing/lisp/test-org-src.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/testing/lisp/test-org-src.el b/testing/lisp/test-org-src.el
index a634d85e8..5a3af8bb3 100644
--- a/testing/lisp/test-org-src.el
+++ b/testing/lisp/test-org-src.el
@@ -416,7 +416,11 @@ This is a tab:\t.
      (let ((org-edit-src-content-indentation 2)
 	   (org-src-preserve-indentation nil))
        (font-lock-ensure)
-       (current-column)))))
+       ;; Replacement for `current-column', since it doesn't work with
+       ;; older versions of emacs before commit 4243747b1b8: Fix
+       ;; 'current-column' in the presence of display strings
+       (+ (progn (backward-char) (length (get-text-property (point) 'display)))
+          (current-column))))))
   ;; The initial tab characters respect org's `tab-width'.
   (should
    (equal
@@ -432,7 +436,8 @@ This is a tab:\t.
      (let ((org-edit-src-content-indentation 2)
 	   (org-src-preserve-indentation nil))
        (font-lock-ensure)
-       (current-column))))))
+       (+ (progn (backward-char) (length (get-text-property (point) 'display)))
+          (current-column)))))))
 
 (ert-deftest test-org-src/indented-latex-fragments ()
   "Test editing multiline indented LaTeX fragment."
-- 
2.41.0


  reply	other threads:[~2023-07-07 13:22 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-11 22:33 [BUG] Source block indentation does not work properly for yaml-mode [9.6.6 ( @ /home/user/.emacs.d/elpa/org-9.6.6/)] wolf
2023-06-14 12:16 ` Ihor Radchenko
2023-06-17 19:11   ` Sébastien Miquel
2023-06-18 11:16     ` Ihor Radchenko
2023-06-19  8:43       ` Sébastien Miquel
2023-06-19 11:05         ` Ihor Radchenko
2023-06-19 15:32           ` Sébastien Miquel
2023-06-20 10:02             ` Ihor Radchenko
2023-06-21  5:46               ` Sébastien Miquel
2023-06-25 10:46               ` Ihor Radchenko
2023-06-26 11:14               ` Sébastien Miquel
2023-06-26 11:45                 ` Sébastien Miquel
2023-06-26 11:52                 ` Ihor Radchenko
2023-06-26 12:15                   ` Sébastien Miquel
2023-06-26 12:44                     ` Ihor Radchenko
2023-06-27  8:54                       ` Sébastien Miquel
2023-06-28  9:21                         ` Ihor Radchenko
2023-06-29 15:54                           ` Sébastien Miquel
2023-06-30 11:43                             ` Ihor Radchenko
2023-06-30 20:27                               ` Sébastien Miquel
2023-07-01 11:07                                 ` Ihor Radchenko
2023-07-01 17:17                                   ` Sébastien Miquel
2023-07-03  9:58                                     ` Ihor Radchenko
2023-07-03 12:49                                       ` Sébastien Miquel
2023-07-03 13:05                                         ` Ihor Radchenko
2023-07-03 13:48                                           ` Sébastien Miquel
2023-07-04 10:41                                             ` Ihor Radchenko
2023-07-06 11:01                                               ` Sébastien Miquel
2023-07-07  9:26                                                 ` Ihor Radchenko
2023-07-07  9:54                                                   ` Ihor Radchenko
2023-07-07 13:21                                                     ` Sébastien Miquel [this message]
2023-07-08  8:44                                                       ` Ihor Radchenko
2023-07-09 11:10                                                         ` Sébastien Miquel
2023-07-10  8:22                                                           ` Ihor Radchenko
2023-07-07  9:31                                                 ` [BUG] org-list-struct-apply-struct overrides src block indentation (was: [BUG] Source block indentation does not work properly for yaml-mode [9.6.6 ( @ /home/user/.emacs.d/elpa/org-9.6.6/)]) Ihor Radchenko
2023-07-07 13:43                                                   ` Sébastien Miquel
2023-07-08  9:06                                                     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=685a46ca-07c4-d7ad-e710-b4ae151e43fe@posteo.eu \
    --to=sebastien.miquel@posteo.eu \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).