emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Raffael Stocker <r.stocker@mnet-mail.de>
To: emacs-orgmode@gnu.org
Subject: [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]
Date: Mon, 17 Jun 2024 10:50:41 +0200	[thread overview]
Message-ID: <yplmfrtchs0u.fsf@mnet-mail.de> (raw)

[-- 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:



             reply	other threads:[~2024-06-17  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17  8:50 Raffael Stocker [this message]
2024-06-17 17:23 ` [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)] Ihor Radchenko
2024-06-17 19:23   ` Raffael Stocker
2024-06-18 12:52     ` 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=yplmfrtchs0u.fsf@mnet-mail.de \
    --to=r.stocker@mnet-mail.de \
    --cc=emacs-orgmode@gnu.org \
    /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).