From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kBuaGTaw5GL4jwAAbAwnHQ (envelope-from ) for ; Sat, 30 Jul 2022 06:14:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sKWQGTaw5GL+cgAA9RJhRA (envelope-from ) for ; Sat, 30 Jul 2022 06:14:46 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D911F23AF8 for ; Sat, 30 Jul 2022 06:14:42 +0200 (CEST) Received: from localhost ([::1]:35860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHds9-0000Bu-Pe for larch@yhetil.org; Sat, 30 Jul 2022 00:14:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHdr1-0007tR-UK for emacs-orgmode@gnu.org; Sat, 30 Jul 2022 00:13:31 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:56041) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHdqz-0000qs-Nd for emacs-orgmode@gnu.org; Sat, 30 Jul 2022 00:13:31 -0400 Received: by mail-pj1-x1036.google.com with SMTP id b10so6171637pjq.5 for ; Fri, 29 Jul 2022 21:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=uWk3kIhmqtFddIGDm0ekztDjp1Kn7R+aiP6I6f3YNS0=; b=NNZ7hzqXzD+MyMIwWT1B8IDSCz+uVgiVYqWzPArhdqa2g3l9sf/TTTXxFjtKzC4Qb6 MBzYLMhGPY8WLlXWqW1tGjwZh9hNmj45OqeC7zwBOJ50pUS0fjAbUt1IR7JlA8+pD3bL DDHoZH1GkAUkBVrAFzLc2/cJ1QFMXZ7qNmLgfr6VhHLP/ZFG5VqgLLHK/ckUMChJglfi XmKO7spxFghENDzVn03EoQlXPPtqM9U4/qsrpSH2Dgxw3yP2TBNx3LarNJ5YI6IvRwyo GXUr8/2KRwDk9LGxezSUz9OCvUJ/BzIV+YfAzBO/kj01ns6qhYkRMfg3tV1atnNuoYPJ ipwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=uWk3kIhmqtFddIGDm0ekztDjp1Kn7R+aiP6I6f3YNS0=; b=vmjW3EqJIJYl9T8ml/u47CzQufo1AjEPGs3szQf5B+RddIMwdS3b7iyMeKyJF1JT+f D2NtJ7wEq6Zdymm4PmVwoR7UmBS/u+ELa5VGNwfze7RG2twtXmeh6mCDDytEED9HYJwc nzDLqlnBu2m/ZjgYHnI0dRARZaTIAlo+0v8gRgusOUubPKALIlrAWx+9hvN+ID3xZEoL npVtGNMXeSjY894DnPuVY1+OmM/euRk3ZM5/DpIacYc1tqLGa1fByNHmDQmDeHmI1GTp quQoSBJ4ancRgSum3UOi6abm2Q2NlsAHVXAsnvSJclE/YfNuNF0t9ahz6rE2cP6ch7Sy asUQ== X-Gm-Message-State: ACgBeo2Z1yDgXzpg9cstkmcFioUFtvq/hz2ES5+xjpoCtIv6Ae+Zys8N 1OKvBtwH+RajKXgOJPkteVTnN56CQJA= X-Google-Smtp-Source: AA6agR7v/BYQDlRvoQ2ZPpBbnBtkI/SOBaTEa/j4zKmDEStCNpBcDJ3SRja+tm566nHyH5mh8451FQ== X-Received: by 2002:a17:902:ba91:b0:16d:3119:7fea with SMTP id k17-20020a170902ba9100b0016d31197feamr6913202pls.57.1659154407615; Fri, 29 Jul 2022 21:13:27 -0700 (PDT) Received: from localhost ([1.83.155.1]) by smtp.gmail.com with ESMTPSA id t5-20020a1709027fc500b0016db774e702sm4442699plb.93.2022.07.29.21.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 21:13:26 -0700 (PDT) From: Ihor Radchenko To: emacs-orgmode Subject: [PATCH] Re: [BUG] org-colview tests fail in Emacs 29 because of wrong org-colview's assumptions about current-column [9.5.4 (release_9.5.4-626-g45f9d8.dirty @ /home/yantar92/.emacs.d/straight/build/org/)] In-Reply-To: References: Date: Sat, 30 Jul 2022 12:14:28 +0800 Message-ID: <8735ejuti3.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659154483; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=uWk3kIhmqtFddIGDm0ekztDjp1Kn7R+aiP6I6f3YNS0=; b=HJMaEN3PGAaopcBvKzkqwCyA71YzS2V4vfO/jpspFrsJLnA03QZC19LV5flfOENajLbNel hSHoxgkQRkBaf1wf0l8YNc4KFi++2UK3qOmk66K1P7KzhqTJSDPf3ROmNdrpKIg6EX+QVs DhyljKNcKjC2UPNgBk9u2w2CBPNBPxIXeaCJAHqfJ19J84Z55E+TtvTOKrcDTHyxceNXaK O0Z2H66XXDZ7XhrRXzgHLQSUFGoNoY9/oFdq7lMJkM/yX2D0rf0VZTB1BGm5czu0ggTOAB G+6XNvpA4pZ/vTPDt0jbpBmDP+aZVqxt9GEJvawRTDMLw9FuHyXu3Kwzm2P46A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659154483; a=rsa-sha256; cv=none; b=sm0EfruyhW5U436ahDQbirWFwQJkDC3S/AbW0xTM6M3YIZdzpP4G6FmyVRf/M2q+NKQVIa GI2g+nDWNaLL7fVUo/e4CdglebFZ2ekHKHMOIuP04bVmVqSpA/uE8K8Nf0xqF1DOwnTHdy 7eqmGxmVjDGn6KMFWnEwdOHq/0LMONu2k6t2n2ESro912B0d+4uctXbTb8GLmdifZ2L/Sj 1SpKR/XvTZBGjtgp6OEXJL0fcWCXCJ66wwKmYoT8OEtTRpF9EDX5Wbk6AJpvFQirY6F7/t c52DdOgmnA0oUHjx/CDDbVY7wjkUek+9q8aVulGTEeDAmFU5Q6hz8VOi5aPp2Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NNZ7hzqX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.19 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NNZ7hzqX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D911F23AF8 X-Spam-Score: -7.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: t4RG4ZTesgZL --=-=-= Content-Type: text/plain Ihor Radchenko writes: > On Emacs 29, make test will fail on both bugfix and main: > > 5 unexpected results: > FAILED test-org-colview/columns-move-left > FAILED test-org-colview/columns-move-right > FAILED test-org-colview/columns-new > FAILED test-org-colview/columns-next-allowed-value > FAILED test-org-colview/columns-update I am attaching a tentative fix. Also, note that `current-column' is used, for example, in org-element list parser. If users use some kind of weird font-lock that replaces indentation in Org lists, our parser may become faulty. Similarly, `current-column' is being used in few more places across Org. I am not yet fixing such possible issues, but it would be helpful if someone comments on the considered possibilities. Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-colview-Do-not-rely-on-current-column-ignoring-d.patch >From 8f56cf22ff1727542a237a2ed39d48eca1479414 Mon Sep 17 00:00:00 2001 Message-Id: <8f56cf22ff1727542a237a2ed39d48eca1479414.1659154264.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sat, 30 Jul 2022 12:07:14 +0800 Subject: [PATCH] org-colview: Do not rely on `current-column' ignoring display properties * lisp/org-macs.el (org-current-text-column): New macro calculating current column without accounting display text properties. * lisp/org-colview.el (org-columns-check-computed): (org-columns-next-allowed-value): (org-columns-new): (org-columns-delete): (org-columns-edit-attributes): (org-columns-widen): (org-columns-move-right): (org-columns-move-left): (org-columns-update): Use the new macro when calculating point position in the column view table overlay. Do _not_ use the new macro when we want to get the visual column position of the point. Fixes "test-org-colview/" failures on Emacs 29 after Emacs commit 4243747b1b8c3b7e3463822804b32e83febe2878: ;; Fix 'current-column' in the presence of display strings ;; * src/indent.c (check_display_width): Support calculation of width ;; of 'display' properties whose values are strings. This fixes the ;; value returned by 'current-column' when display strings are ;; present between BOL and point. (Bug#53795) See https://orgmode.org/list/CACnOyijQc7BDDtrYQb+=VoGWkpWAyMu7O4qsvGpsU6SCgwiM8Q@mail.gmail.com --- lisp/org-colview.el | 25 +++++++++++++------------ lisp/org-macs.el | 5 +++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 13643101b..2829678f5 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -557,7 +557,7 @@ (defun org-columns-quit () (defun org-columns-check-computed () "Throw an error if current column value is computed." - (let ((spec (nth (current-column) org-columns-current-fmt-compiled))) + (let ((spec (nth (org-current-text-column) org-columns-current-fmt-compiled))) (and (nth 3 spec) (assoc spec (get-text-property (line-beginning-position) 'org-summaries)) @@ -713,7 +713,8 @@ (defun org-columns-next-allowed-value (&optional previous nth) an integer, select that value." (interactive) (org-columns-check-computed) - (let* ((column (current-column)) + (let* ((column (org-current-text-column)) + (visible-column (current-column)) (key (get-char-property (point) 'org-columns-key)) (value (get-char-property (point) 'org-columns-value)) (pom (or (get-text-property (line-beginning-position) 'org-hd-marker) @@ -763,7 +764,7 @@ (defun org-columns-next-allowed-value (&optional previous nth) ;; the right place on the current line. (let ((org-columns-inhibit-recalculation)) (org-columns-redo)) (org-columns-update key) - (org-move-to-column column)))))) + (org-move-to-column visible-column)))))) (defun org-colview-construct-allowed-dates (s) "Construct a list of three dates around the date in S. @@ -925,14 +926,14 @@ (defun org-columns-new (&optional spec &rest attributes) (if spec (progn (setcar spec (car new)) (setcdr spec (cdr new))) - (push new (nthcdr (current-column) org-columns-current-fmt-compiled))) + (push new (nthcdr (org-current-text-column) org-columns-current-fmt-compiled))) (org-columns-store-format) (org-columns-redo))) (defun org-columns-delete () "Delete the column at point from columns view." (interactive) - (let ((spec (nth (current-column) org-columns-current-fmt-compiled))) + (let ((spec (nth (org-current-text-column) org-columns-current-fmt-compiled))) (when (y-or-n-p (format "Are you sure you want to remove column %S? " (nth 1 spec))) (setq org-columns-current-fmt-compiled @@ -942,18 +943,18 @@ (defun org-columns-delete () ;; updating it may prove counter-intuitive. See comments in ;; `org-columns-move-right' for details. (let ((org-columns-inhibit-recalculation t)) (org-columns-redo)) - (when (>= (current-column) (length org-columns-current-fmt-compiled)) + (when (>= (org-current-text-column) (length org-columns-current-fmt-compiled)) (backward-char))))) (defun org-columns-edit-attributes () "Edit the attributes of the current column." (interactive) - (org-columns-new (nth (current-column) org-columns-current-fmt-compiled))) + (org-columns-new (nth (org-current-text-column) org-columns-current-fmt-compiled))) (defun org-columns-widen (arg) "Make the column wider by ARG characters." (interactive "p") - (let* ((n (current-column)) + (let* ((n (org-current-text-column)) (entry (nth n org-columns-current-fmt-compiled)) (width (aref org-columns-current-maxwidths n))) (setq width (max 1 (+ width arg))) @@ -969,7 +970,7 @@ (defun org-columns-narrow (arg) (defun org-columns-move-right () "Swap this column with the one to the right." (interactive) - (let* ((n (current-column)) + (let* ((n (org-current-text-column)) (cell (nthcdr n org-columns-current-fmt-compiled)) e) (when (>= n (1- (length org-columns-current-fmt-compiled))) @@ -993,7 +994,7 @@ (defun org-columns-move-right () (defun org-columns-move-left () "Swap this column with the one to the left." (interactive) - (let* ((n (current-column))) + (let* ((n (org-current-text-column))) (when (= n 0) (error "Cannot shift this column further to the left")) (backward-char 1) @@ -1039,7 +1040,7 @@ (defun org-columns-update (property) (let ((key (overlay-get ov 'org-columns-key))) (when (and key (equal key p) (overlay-start ov)) (goto-char (overlay-start ov)) - (let* ((spec (nth (current-column) org-columns-current-fmt-compiled)) + (let* ((spec (nth (org-current-text-column) org-columns-current-fmt-compiled)) (value (or (cdr (assoc spec (get-text-property (line-beginning-position) @@ -1049,7 +1050,7 @@ (defun org-columns-update (property) (let ((displayed (org-columns--displayed-value spec value)) (format (overlay-get ov 'org-columns-format)) (width - (aref org-columns-current-maxwidths (current-column)))) + (aref org-columns-current-maxwidths (org-current-text-column)))) (overlay-put ov 'org-columns-value value) (overlay-put ov 'org-columns-value-modified displayed) (overlay-put ov diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 1dc0b7080..44060f831 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1037,6 +1037,11 @@ (defun org-string-width (string &optional pixels) pixel-width (/ pixel-width symbol-width))))))) +(defmacro org-current-text-column () + "Like `current-column' but ignore display properties." + `(string-width (buffer-substring-no-properties + (line-beginning-position) (point)))) + (defun org-not-nil (v) "If V not nil, and also not the string \"nil\", then return V. Otherwise return nil." -- 2.35.1 --=-=-=--