Subject: bug#56345: Typo fix and convenience function

From: Thuna <[email-masked]>
Date: Sat, 02 Jul 2022 18:34:29 +0300

I apparently had a couple typos that I missed, the patch 0003 is to fix
that.

Also, I figured it would be convenient to have a way to specify the
column to hide by name, so I created a function named
`tabulated-list-hide-column', which `tabulated-list-hide-current-column'
now calls.  I didn't test it but the code is directly ripped from the
original function so I don't think there will be any problems.  That is
in the patch 0004.

>From c96ab25defb31fc596818a39e1a632dd09e2cc72 Mon Sep 17 00:00:00 2001
From: Thuna <[email-masked]>
Date: Sat, 2 Jul 2022 18:21:53 +0300
Subject: [PATCH 3/4] Fix typos in tabulated-list-make-column-visible

In the docstring: propmted -> prompted
In the `completing-read' prompt: colummn -> column
---
 lisp/emacs-lisp/tabulated-list.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 4e0b3b9e95..96607307fa 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -791,11 +791,11 @@ tabulated-list-hide-current-column
 
 (defun tabulated-list-make-column-visible (name)
   "Make the tabulated list column NAME visible.
-Interactively, NAME is a hidden column propmted for with
+Interactively, NAME is a hidden column prompted for with
 `completing-read'."
   (interactive
    (list
-    (completing-read "Colummn name: "
+    (completing-read "Column name: "
                      (append tabulated-list-format nil)
                      (lambda (col)
                        (plist-get (nthcdr 3 col) :hidden))
-- 
2.35.1

>From 6198fb2b57a9c8267d86baac40406d05ef62eb2a Mon Sep 17 00:00:00 2001
From: Thuna <[email-masked]>
Date: Sat, 2 Jul 2022 18:24:34 +0300
Subject: [PATCH 4/4] Allow interactive hiding of a specific column in
 tabulated-list

* tabulated-list.el (tabulated-list-hide-column
tabulated-list-hide-current-column): The command
`tabulated-list-hide-current-column' is now a wrapper for
`tabulated-list-hide-column', a function which takes the name of the
column and hides it.  This can be called interactively similar to
`tabulated-list-make-column-visible'
---
 lisp/emacs-lisp/tabulated-list.el | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 96607307fa..c04a539ed8 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -778,8 +778,21 @@ tabulated-list-narrow-current-column
 (defun tabulated-list-hide-current-column ()
   "Hide the current tabulated list column."
   (interactive)
-  (let ((col-nb (tabulated-list--column-number
-                 (tabulated-list-get-column))))
+  (tabulated-list-hide-column
+   (tabulated-list-get-column)))
+
+(defun tabulated-list-hide-column (name)
+  "Hide the tabulated list column NAME.
+Interactively, NAME is a visible column prompted for with
+`completing-read'"
+  (interactive
+   (list
+    (completing-read "Column name"
+                     (append tabulated-list-format nil)
+                     (lambda (col)
+                       (not (plist-get (nthcdr 3 col) :hidden)))
+                     t)))
+  (let ((col-nb (tabulated-list--column-number name)))
     ;; `tabulated-list-format' may be a constant (sharing list
     ;; structures), so copy it before mutating.
     (setq tabulated-list-format (copy-tree tabulated-list-format t))
-- 
2.35.1