From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 2DT7LthBEWbaAgEA62LTzQ:P1 (envelope-from ) for ; Sat, 06 Apr 2024 14:36:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 2DT7LthBEWbaAgEA62LTzQ (envelope-from ) for ; Sat, 06 Apr 2024 14:36:40 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qe3vBk6P; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1712407000; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=IV8k2yEjgveqD7dyU98D3P6aDfxgulewg5KghtYj6LA=; b=CqbjOrlKR89Uqu/NeCK6tiBEdwj9aPKvdEOb5Bv00Zaa3EYzqLvn4YEm7PNfCT2FzLH5He JEDUnWGm70v3vi5N++PZ4hnd62nhMC/xBxFceprvWrUaGS60G5MP3zTfOrLPRbeiFEn4jM BwbodhviEagd/qWlqq5nD6kUztJozTA/ZOQLTfYOE9KcZikZa4P/F224Lzw++z2mxiiEaO a+wAiNNf+p8X0M2o8FGWNpArTC1R5U6G/yS46nXARRQxRWtVvT1hvdwpuu0lZvgsq8VBft sW9MuQWdj3etT87kxVY1ChLd8ap2ApQDH3ufgoP0TMYRiWj7JqsjbBtX4u55WQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1712407000; a=rsa-sha256; cv=none; b=mlqzaxBFNeEAAFoPkvLBdXN6pRXjCg0/Djh3fgVkds4x9eyGxegy6ddtVGY91osqCB3CWX iW14NES/t1FaYHbn+HjE1USIuF6LwBYUaEiF0CRQnkAgAy8DSf/V7VUp74c7uAireJ2x++ at8ircRSFy5NwkneRGvao2fCFmbPow1v3DRn/lAMC/ZXIP1FOpf4fi4BzkMbOO7NgHoADE ZxTVbMpuSmvXemfhcdPaF3QJGob2gox3u60gPykFxrKBByUTeBZcNPXNYHcJwL/vkT0YeL KemQSg9GJwL/okwYf/ruboE4Zkzs0hqVYzbbq1EczX86lXf3r6SYzB7Yg1qBpQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qe3vBk6P; 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"; dmarc=pass (policy=none) header.from=posteo.net 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 9B5CF2640A for ; Sat, 6 Apr 2024 14:36:40 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rt5Gx-0003ri-D6; Sat, 06 Apr 2024 08:35:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rt5Gt-0003qv-BY for emacs-orgmode@gnu.org; Sat, 06 Apr 2024 08:35:47 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rt5Gq-000838-PR for emacs-orgmode@gnu.org; Sat, 06 Apr 2024 08:35:47 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 03B89240101 for ; Sat, 6 Apr 2024 14:35:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712406943; bh=gD1d408ntIb7+1d3yOA2C7VzTl4od/pVEns4k24wB6o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=qe3vBk6P/85yyhFHUDPHqShcAO7S1um4Xa1LOcj8ZtYvk2ThJIYyFLPXiz409ljsC 0GpxpDLXFeh8905I2EIU4a9VdMa8MF7zbTN+bENcMOod0zefegbCSDKBcFT+IqrYTl SaczdudHh6O59BObj1sJBK48U17fy5Ua5CR5WHKHXl/I4tJfG0wcApJVv2VfT+E78j 12jKr17H4SU3PHV6nmw1lFxu1VS20vihjyRJmhTbK3lISypyKmKWN1HTw4cdWkIY2e BptVlZpvKWCi+QBeHOYU9f5qwLySz8mfLk4pkZwoEMO2FtLuEQdqrf2fjhPq7CLJWF LHPWt/k9wDBHw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VBZZk1Gcyz9rxB; Sat, 6 Apr 2024 14:35:41 +0200 (CEST) From: Ihor Radchenko To: Lei Zhe , Bastien Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Ensure org-table-header displays without cursor inside table In-Reply-To: References: <87cyr3odq8.fsf@localhost> Date: Sat, 06 Apr 2024 12:36:01 +0000 Message-ID: <87plv2pt1q.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.56 X-Spam-Score: -9.56 X-Migadu-Queue-Id: 9B5CF2640A X-Migadu-Scanner: mx12.migadu.com X-TUID: P/EmXl5LP5AH --=-=-= Content-Type: text/plain [ Adding Org mailing list back to CC. Please use "Reply All" to keep the conversation public ] Lei Zhe writes: >> May you please explain in more details what problem you are trying to >> solve? > Sure. I've identified an issue on the master branch where, if the cursor is > not inside the table at WS, `org-table-begin' in > `org-table-header-set-header' > gets the beginning position of the next table in the buffer. > so `(pos-visible-in-window-p beg)' returns true, causing the header overlay > of the table at WS to not display. > >> Moving point to WS and then immediately to the beginning of the table >> makes no difference. So, your patch does nothing. > Moving point to WS ensures`org-table-begin' to get the beginning position > of the table at WS, regardless of the cursor position, which resolves the > above problem. Thanks for the explanation. Now the patch makes more sense. I am attaching a modified version of the patch with updated commit message and a code comment added explaining why we need to move to WS. P.S. Bastien, may your please check Lei Zhe's copyright status? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-table-header-line-mode-Fix-when-cursor-is-outsid.patch >From e26d940c4d5463d65a25a40ad5a7bd0a57538a3a Mon Sep 17 00:00:00 2001 Message-ID: From: llcc Date: Fri, 5 Apr 2024 22:07:12 +0800 Subject: [PATCH] org-table-header-line-mode: Fix when cursor is outside table * lisp/org-table.el (org-table-header-set-header): Display table header even when the point is below the table, as long as the table is visible at the top of the window. --- lisp/org-table.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/org-table.el b/lisp/org-table.el index bd8d59f45..f0e9c2682 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -494,6 +494,11 @@ (defun org-table-header-set-header () (redisplay) (let* ((ws (window-start)) (beg (save-excursion + ;; Check table at window start, not at point. + ;; Point might be after the table, or at + ;; another table located below the one visible + ;; on top. + (goto-char ws) (goto-char (org-table-begin)) (while (or (org-at-table-hline-p) (looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>")) -- 2.44.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--