all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]
@ 2024-06-17  8:50 Raffael Stocker
  2024-06-17 17:23 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Raffael Stocker @ 2024-06-17  8:50 UTC (permalink / raw)
  To: emacs-orgmode

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


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

Hello fellow org-modists,

in columnview dblocks, attribute and tblfm lines wander to the right
instead of staying in place when the table is re-evaluated (see the
example file in the appendix).  This could be cured with a couple of
‘string-trim-left’ applications in ‘org-columns-dblock-write-default’
like so:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: columnview trim patch --]
[-- Type: text/x-patch, Size: 856 bytes --]

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 961ae0fbe..bc93941e4 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1662,7 +1662,7 @@ defun org-columns-dblock-write-default
 	;; Insert affiliated keywords before the table.
 	(when content-lines
 	  (while (string-match-p "\\`[ \t]*#\\+" (car content-lines))
-	    (insert (pop content-lines) "\n")))
+	    (insert (string-trim-left (pop content-lines)) "\n")))
 	(save-excursion
 	  ;; Insert table at point.
 	  (insert
@@ -1675,7 +1675,7 @@ defun org-columns-dblock-write-default
 	  (let ((case-fold-search t))
 	    (dolist (line content-lines)
 	      (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line)
-		(insert "\n" line)
+		(insert "\n" (string-trim-left line))
 		(unless recalc (setq recalc t))))))
 	(when recalc (org-table-recalculate 'all t))
 	(org-table-align)

[-- Attachment #3: Type: text/plain, Size: 203 bytes --]


Regards,
Raffael

Emacs  : GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)
Package: Org mode version 9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)


[-- Attachment #4: columnview with wandering lines --]
[-- Type: text/x-org, Size: 761 bytes --]


* Overview

  The ~ATTR_LATEX~ and ~TBLFM~ lines will wander to the right with every ‘C-c C-c’
  on the columnview.

  #+BEGIN: columnview :hlines 1 :id "tasks"
  #+ATTR_LATEX: :width \textwidth
  | <40>  |                  |               |       |
  | Task  | Estimated Effort | Actual Effort |       |
  |-------+------------------+---------------+-------|
  | Tasks |            20:00 |               | 20.00 |
  | Foo   |             8:00 |               |  8.00 |
  | Bar   |            12:00 |               | 12.00 |
  #+TBLFM: $4=$2;t
  #+END:

  
* Tasks
  :PROPERTIES:
  :ID: tasks
  :END:
  
** TODO Foo
   :PROPERTIES:
   :Effort:   8:00
   :END:
  
** TODO Bar
   :PROPERTIES:
   :Effort:   12:00
   :END:



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]
  2024-06-17  8:50 [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)] Raffael Stocker
@ 2024-06-17 17:23 ` Ihor Radchenko
  2024-06-17 19:23   ` Raffael Stocker
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-06-17 17:23 UTC (permalink / raw)
  To: Raffael Stocker; +Cc: emacs-orgmode

Raffael Stocker <r.stocker@mnet-mail.de> writes:

> in columnview dblocks, attribute and tblfm lines wander to the right
> instead of staying in place when the table is re-evaluated (see the
> example file in the appendix).  This could be cured with a couple of
> ‘string-trim-left’ applications in ‘org-columns-dblock-write-default’
> like so:
> ...

Thanks for reporting and providing a diff!
May you please convert the diff into a proper patch, so that I can
install it under your name?
See https://orgmode.org/worg/org-contribute.html#first-patch

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]
  2024-06-17 17:23 ` Ihor Radchenko
@ 2024-06-17 19:23   ` Raffael Stocker
  2024-06-18 12:52     ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Raffael Stocker @ 2024-06-17 19:23 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Ihor Radchenko <yantar92@posteo.net> writes:

> May you please convert the diff into a proper patch, so that I can
> install it under your name?

I gave it a try, please see the attachment.

Cheers,
Raffael


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: columnview left trim patch --]
[-- Type: text/x-patch, Size: 1314 bytes --]

From a94c25606164678b7887e9cc45c059b025f5140c Mon Sep 17 00:00:00 2001
From: Raffael Stocker <r.stocker@mnet-mail.de>
Date: Mon, 17 Jun 2024 21:09:45 +0200
Subject: [PATCH] lisp/org-colview.el: Prevent repeated indentation of keyword
 lines

* org-colview.el (org-columns-dblock-write-default): left trim keyword
and TBLFM lines to prevent repeated indentation.
---
 lisp/org-colview.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 961ae0fbe..bc93941e4 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1662,7 +1662,7 @@ defun org-columns-dblock-write-default
 	;; Insert affiliated keywords before the table.
 	(when content-lines
 	  (while (string-match-p "\\`[ \t]*#\\+" (car content-lines))
-	    (insert (pop content-lines) "\n")))
+	    (insert (string-trim-left (pop content-lines)) "\n")))
 	(save-excursion
 	  ;; Insert table at point.
 	  (insert
@@ -1675,7 +1675,7 @@ defun org-columns-dblock-write-default
 	  (let ((case-fold-search t))
 	    (dolist (line content-lines)
 	      (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line)
-		(insert "\n" line)
+		(insert "\n" (string-trim-left line))
 		(unless recalc (setq recalc t))))))
 	(when recalc (org-table-recalculate 'all t))
 	(org-table-align)
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]
  2024-06-17 19:23   ` Raffael Stocker
@ 2024-06-18 12:52     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-06-18 12:52 UTC (permalink / raw)
  To: Raffael Stocker; +Cc: emacs-orgmode

Raffael Stocker <r.stocker@mnet-mail.de> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> May you please convert the diff into a proper patch, so that I can
>> install it under your name?
>
> I gave it a try, please see the attachment.

Thanks!
Applied, onto bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=157a0559e

You are also now listed as Org mode contributor:
https://git.sr.ht/~bzg/worg/commit/b747280a

Fixed.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-18 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17  8:50 [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)] Raffael Stocker
2024-06-17 17:23 ` Ihor Radchenko
2024-06-17 19:23   ` Raffael Stocker
2024-06-18 12:52     ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.