From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id YG0bOhubLmSfTgEASxT56A (envelope-from ) for ; Thu, 06 Apr 2023 12:12:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id COcdORubLmTEAwEAG6o9tA (envelope-from ) for ; Thu, 06 Apr 2023 12:12:43 +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 5950FAA62 for ; Thu, 6 Apr 2023 12:12:43 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkMaw-0008Gp-1N; Thu, 06 Apr 2023 06:11:54 -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 1pkMau-0008GL-F7 for emacs-orgmode@gnu.org; Thu, 06 Apr 2023 06:11:52 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pkMas-0001ld-2s for emacs-orgmode@gnu.org; Thu, 06 Apr 2023 06:11:51 -0400 Received: by mail-lf1-x133.google.com with SMTP id g29so268684lfj.4 for ; Thu, 06 Apr 2023 03:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680775907; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=ofmcLu8vkDn+aZ92XOyxzCzV8ebDPDo9/G+a7SVyNWo=; b=TKf4ixbW9HTHfV4Bw2gAYLF4QtiiE4+LZRh1DSHM6A/ijA+fRjB4uEIbngctDleRFY tpWs3TN0CIsohl5PbSrj61eAcHHh7EA3UTz8AOgm+fnG8Ir6b82HlzvwXwGLwPUcjgL1 +EdoXQHl+/GOdrZI473UIGmtuir1a1eT3UXATswkmIqwoRQd1zTnV/H9YsfZvyNwATrs Olu0oOFqc3FTMb4RFJjmGl9XQB1g0usk/zKhhLMA9l0IclIfFZsQIV8uZGDXauLpNQL3 AUC825fWhaRL8jsewcjxFTn1PgOqkDK7pjrmocK3uuObMKs7/IdMDhi6dG7yoZKJgOJU zbCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680775907; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ofmcLu8vkDn+aZ92XOyxzCzV8ebDPDo9/G+a7SVyNWo=; b=BS1Vddqv3+0v79RP5w+8X/WdJLRb2yg8TkZniF/ix4GC5OerQTL8oCdvLfMTo4cG7z tcqGrZO0vzsjUWFhG+hW5+RSR+9L2wdYQ3iQ9No/8/C9BJvEeYu9tE2p9DZTVLZGyO6C RufW2F0qunDg00by3oHZEhZwx+dGV2pxTq4jcZBQMS+Q1wbcn+2dGRFseiU4Lf+LSsQQ nJhCNOzyWwUrZVT1caQjN3uc6J3AZp8GjH5nogEDoBTji/Dpet6OABvXpHwQd9SBgtDd KGIBD9ystVf4expuePr7i3oyotj+k9/Igk1bTLvHVB8Qd0M455BB6G4w/DyIX2QUgwCD EwNg== X-Gm-Message-State: AAQBX9evW7iQKSdaT+bp7pNh92HUR0X/FbUvTmgLTv2qEIt+sgqrbL9Z RoLK0E/6dTPpUUrCrbrbSHcUPKj0o271KQ== X-Google-Smtp-Source: AKy350aSFGZFjqAKx56IifaZVbEzvOChsKo6UoXgwWc5BchZG/YtOygQWlJnBFQu+gSHirW2h5YBHQ== X-Received: by 2002:a05:6512:991:b0:4eb:7fa:38b9 with SMTP id w17-20020a056512099100b004eb07fa38b9mr1923222lft.8.1680775907187; Thu, 06 Apr 2023 03:11:47 -0700 (PDT) Received: from windows ([2a01:110f:1506:3300:d4ec:a72d:e609:d1fb]) by smtp.gmail.com with ESMTPSA id y10-20020ac2446a000000b004b4b600c093sm201298lfl.92.2023.04.06.03.11.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 03:11:46 -0700 (PDT) From: =?utf-8?Q?S=C5=82awomir_Grochowski?= To: emacs-orgmode@gnu.org Subject: [RFC] [feat] org-colview/org-columns: 'column view' moving rows up/down Date: Thu, 06 Apr 2023 12:11:46 +0200 Message-ID: <87lej51frx.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=slawomir.grochowski@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1680775963; a=rsa-sha256; cv=none; b=rfluWOx/qH4xY2DZFnnGJZeNgsRLTBPtxjDs8fQH84M+E9RuNBaqd2TJXGtIB6Jarv3Z2E mBSbV3fekTW8HgOQ/eU1Pa14CLlNsRx2T0br5yH9A5s3x3UM6RKeAx9ELYzJ2OgxQuiyKq NgmQ8mPdm4k9IhT6OpfVifDAHrJnCbhqG2fg3/CiOeuaEYtBfgZBJ2IVFXcb4pqjOFcu9s XddhaEWIPgjBs4bHb9AK0J+BtIQD+T460rYfFfTnhPmb5kYq+VPgxgt4tXvvvpzswQk0tQ Ak+3n9CBmDnovtHx8inMy5d60aT0FO9kAPGj1t0nhFKbGt8BKRAR4tFIgptEfw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TKf4ixbW; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1680775963; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ofmcLu8vkDn+aZ92XOyxzCzV8ebDPDo9/G+a7SVyNWo=; b=CzMQ7iMiHJ3NWj7K/i8NiehfAmhrj8fYqFxl6JAD8si45nTYPaAmA+xbOuRn5RmY1ClTHs avE3vvR57EQoyQ47d3iN3GAjgQ5nbkYUYSrOltkyU+Gby17NbKA/YCvR/gaDPSTqOCFj0L 3urfIBakcTYJ/HBlkHBp6l43VMbGED2Jy5AV1ykftzskk36Z1hmiqXI6/PqVCTSNRjxPCb 03C0N1Jc+0NyJUiaGoUFzmlX1coBf60FePNfgk2Qglfao6iwJpg4EexQV6AXJlH8H03C5O Fbxu7Xi9kKH3rXp7Csvt2+rv+iElpW5E17bFGpipllw7yydZhDMy15R2r4VOBQ== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TKf4ixbW; 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-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -9.95 X-Spam-Score: -9.95 X-Migadu-Queue-Id: 5950FAA62 X-TUID: Nd1jiJKNVZbK --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Dear All, This is my first proposal & code submit.=20 I will be very gratefull for you comments & feedback what can be done bette= r.=20=20 Recently I often use 'column view' feature.=20 To my suprise in 'column view' user can't move rows up & down. So I wrote a little code snippet to be able to do it, and I'm sharing it wi= th you. Questions: 1. Why user can't move rows up & down in 'column view'? 2. Is this was intentional design decision? I think 'column view' is missing one the core feel & functionality of org-m= ode - moving rows (headings) up & down. In my experiance with 'column view' & tables I shuffle a lot of columns & r= ows order. In my point of view 'core fuctionalities of org-mode' are:=20 1. moving 'things' headings, rows, columns 1. horizontally (left-right) 2. vertically (up-down) 2. cyclic visibility Let's compare this functionality in 3 areas:=20=20 | | heading | table | column view | |-------------------+---------+-------+-------------| | moving left-right | [X] | [X] | [X] | | moving up-down | [X] | [X] | [ ] | | cyclic visibility | [X] | NA | [X] | Cyclic visibility does not apply to 'table' because it operate on simple da= ta, which is not structured, nested. 'Column view' transform 'headings' into rows, and their properties into col= umns, creating a table. 'Column view' is a combination of 'table' & 'heading': 'Heading' gives a 'table' properties for columns and cyclic visibilty featu= re, because it provide nested structure. 'Table' gives a 'heading' a 'column view' on heading properties. 'Column view' is similar to 'table'. They operate on same actions & keybind= ings. | | column view | table | |-----------------------------+------------------+------------------| | move column left-right | [X] | [X] | | move column left-right keys | meta left-right | meta left-right | | move row up-down | [ ] | [X] | | move row up-down keys | | meta up-down | | add column | [X] | [X] | | add column keys | shift-meta right | shift-meta right | | remove column | [X] | [X] | | remove column keys | shift-meta left | shift-meta left | I thnik it would be beneficial to have consistance interface in 'column vie= w' and 'table'. Based on that, I propose to add functionality to 'move row up/down' in 'col= umn view' and set keybinding the same as in table above -> meta up/down. Patch is in the attachment. What others think about it?=20 Regards, S=C5=82awomir Grochowski --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-org-columns-add-feat-to-move-row-up-down.patch Content-Transfer-Encoding: quoted-printable Content-Description: patch >From 1f0f2052b8dddf4982ab35267ed1564f2250784b Mon Sep 17 00:00:00 2001 From: S=C5=82awomir Grochowski Date: Mon, 3 Apr 2023 19:23:09 +0200 Subject: [PATCH] org-columns: add feat to move row up/down --- lisp/org-colview.el | 22 +++++++++++ testing/lisp/test-org-colview.el | 66 ++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 92a3b473d..0971d5eef 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -209,6 +209,8 @@ See `org-columns-summary-types' for details.") (org-defkey org-columns-map ">" #'org-columns-widen) (org-defkey org-columns-map [(meta right)] #'org-columns-move-right) (org-defkey org-columns-map [(meta left)] #'org-columns-move-left) +(org-defkey org-columns-map [(meta down)] #'org-columns-move-row-down) +(org-defkey org-columns-map [(meta up)] #'org-columns-move-row-up) (org-defkey org-columns-map [(shift meta right)] #'org-columns-new) (org-defkey org-columns-map [(shift meta left)] #'org-columns-delete) (dotimes (i 10) @@ -1003,6 +1005,26 @@ details." (org-columns-move-right) (backward-char 1))) =20 +(defun org-columns--move-row (&optional up) + "Move table row. Calls `org-move-subtree-down' or `org-move-subtree-up= '." + (let ((inhibit-read-only t) + (col (current-column))) + (if up (org-move-subtree-up) + (org-move-subtree-down)) + (let ((org-columns-inhibit-recalculation t)) + (org-columns-redo) + (move-to-column col)))) + +(defun org-columns-move-row-down () + "Move table row (subtree) down." + (interactive) + (org-columns--move-row)) + +(defun org-columns-move-row-up () + "Move table row (subtree) up." + (interactive) + (org-columns--move-row 'up)) + (defun org-columns-store-format () "Store the text version of the current columns format. The format is stored either in the COLUMNS property of the node diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colvi= ew.el index 9daec18e2..fd02f054c 100644 --- a/testing/lisp/test-org-colview.el +++ b/testing/lisp/test-org-colview.el @@ -1010,6 +1010,72 @@ (list (get-char-property 1 'org-columns-value-modified) (get-char-property 2 'org-columns-value-modified)))))) =20 +;; Each column is an overlay on top of a character. So there has +;; to be at least as many characters available on the line as +;; columns to display. +;; 'org-columns--display-here' +(ert-deftest test-org-colview/bug-add-whitespace () + "Insert space characters if number of characters on the line + is lower then number of columns." + :expected-result :failed + (should + (equal "* H +** A +** B +" + (org-test-with-temp-text "* H +** A +** B +" + (org-columns) + (buffer-substring-no-properties (point-min) (point-max)))))) + +(ert-deftest test-org-colview/columns-move-row-down () + "Test `org-columns-move-row-down' specifications." + (should + (equal "* H +** B +** A +" + (org-test-with-temp-text "* H +** A +** B +" + (let ((org-columns-default-format "%ITEM")) (org-columns) + (next-line 1) + (org-columns-move-row-down) + (buffer-substring-no-properties (point-min) (point-max)))= )))) + +(ert-deftest test-org-colview/columns-move-row-up () + "Test `org-columns-move-row-up' specifications." + (should + (equal "* H +** B +** A +" + (org-test-with-temp-text "* H +** A +** B +" + (let ((org-columns-default-format "%ITEM")) (org-columns) + (next-line 2) + (org-columns-move-row-up) + (buffer-substring-no-properties (point-min) (point-max)))= )))) + +(ert-deftest test-org-colview/columns-move-row () + "After function call 'org-columns--move-row' point should stay at the sa= me column." + (should + (equal 35 + (org-test-with-temp-text "* H +** A +** B +" + (org-columns) + (next-line 1) + (forward-char 2) + (org-columns-move-row-down) + (current-column))))) + (ert-deftest test-org-colview/columns-move-left () "Test `org-columns-move-left' specifications." ;; Error when trying to move the left-most column. --=20 2.30.2 --=-=-=--