unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
@ 2020-05-04 20:10 Chris McMahan
  2020-05-04 21:01 ` bug#41086: Corrcted patch for bug #41086 Chris McMahan
  2020-05-04 21:02 ` bug#41086: [PATCH] Add user-defined column widths to package-list (package.el) Stefan Kangas
  0 siblings, 2 replies; 11+ messages in thread
From: Chris McMahan @ 2020-05-04 20:10 UTC (permalink / raw)
  To: 41086


[-- Attachment #1.1: Type: text/plain, Size: 844 bytes --]

When executing the function `package-list-packages', the column widths are
too narrow, cutting off a significant
portion of the package names.

This minor patch adds four variables that can be set by the user to adjust
the width of each column within the package list.

Changelog entry
--------------------------------
2020-05-04  Chris McMahan  <cmcmahan@gmail.com>

* package.el ((define-derived-mode package-menu-mode tabulated-list-mode
"Package Menu"):
User can now adjust column widths of the package list by setting the values
of the following:
package-name-column-width (defaults to 30 columns)
package-version-column-width (14 column)
package-status-column-width (12 columns)
package-archive-column-width (14 columns)
--------------------------------

Patch is attached:


-- 
*Chris McMahan <cmcmahan@gmail.com <cmcmahan@gmail.com>>*

[-- Attachment #1.2: Type: text/html, Size: 2086 bytes --]

[-- Attachment #2: package.patch --]
[-- Type: application/octet-stream, Size: 2389 bytes --]

--- v27.0.90_package.el	2020-05-04 15:49:33.387845600 -0400
+++ package.el	2020-05-04 15:50:13.190789400 -0400
@@ -397,6 +397,29 @@
   :type 'boolean
   :version "25.1")
 
+(defcustom package-name-column-width 30
+  "Column width of the 'Package' name within the package list
+invoked through `package-list-packages'."
+  :type 'number
+  :version "27.1")
+
+(defcustom package-version-column-width 14
+  "Column width of the package 'version' within the package list
+invoked through `package-list-packages'."
+  :type 'number
+  :version "27.1")
+
+(defcustom package-status-column-width 12
+  "Column width of the package 'status' within the package list
+invoked from the `package-list-packages' command"
+  :type 'number
+  :version "27.1")
+
+(defcustom package-archive-column-width 14
+  "Width of the archive column in the package list."
+  :type 'number
+  :version "27.1")
+
 \f
 ;;; `package-desc' object definition
 ;; This is the struct used internally to represent packages.
@@ -2750,18 +2773,18 @@
 
 (define-derived-mode package-menu-mode tabulated-list-mode "Package Menu"
   "Major mode for browsing a list of packages.
-Letters do not insert themselves; instead, they are commands.
-\\<package-menu-mode-map>
-\\{package-menu-mode-map}"
+  Letters do not insert themselves; instead, they are commands.
+  \\<package-menu-mode-map>
+  \\{package-menu-mode-map}"
   (setq mode-line-process '((package--downloads-in-progress ":Loading")
                             (package-menu--transaction-status
                              package-menu--transaction-status)))
   (setq tabulated-list-format
-        `[("Package" 18 package-menu--name-predicate)
-          ("Version" 13 package-menu--version-predicate)
-          ("Status"  10 package-menu--status-predicate)
+        `[("Package" ,package-name-column-width package-menu--name-predicate)
+          ("Version" ,package-version-column-width package-menu--version-predicate)
+          ("Status"  ,package-status-column-width  package-menu--status-predicate)
           ,@(if (cdr package-archives)
-                '(("Archive" 10 package-menu--archive-predicate)))
+                '(("Archive" ,package-archive-column-width package-menu--archive-predicate)))
           ("Description" 0 package-menu--description-predicate)])
   (setq tabulated-list-padding 2)
   (setq tabulated-list-sort-key (cons "Status" nil))

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

* bug#41086: Corrcted patch for bug #41086
  2020-05-04 20:10 bug#41086: [PATCH] Add user-defined column widths to package-list (package.el) Chris McMahan
@ 2020-05-04 21:01 ` Chris McMahan
  2020-05-04 21:02 ` bug#41086: [PATCH] Add user-defined column widths to package-list (package.el) Stefan Kangas
  1 sibling, 0 replies; 11+ messages in thread
From: Chris McMahan @ 2020-05-04 21:01 UTC (permalink / raw)
  To: 41086


[-- Attachment #1.1: Type: text/plain, Size: 955 bytes --]

I apologize. The patch I sent WRT bug #41086 was the wrong (nonfunctioning)
version.
Here is a resend of the message, with the correct patch and log:


When executing the function `package-list-packages', the column widths are
too narrow, cutting off a significant portion of the package names.

This minor patch adds three variables that can be set by the user to adjust
the width of each column within the package list.

Changelog entry
--------------------------------
2020-05-04  Chris McMahan  <cmcmahan@gmail.com>

* package.el ((define-derived-mode package-menu-mode tabulated-list-mode
"Package Menu"):
User can now adjust column widths of the package list by setting the values
of the following:
package-name-column-width (defaults to 30 columns)
package-version-column-width (14 column)
package-status-column-width (12 columns)
--------------------------------

Patch is attached:


-- 
*Chris McMahan <cmcmahan@gmail.com <cmcmahan@gmail.com>>*

[-- Attachment #1.2: Type: text/html, Size: 2094 bytes --]

[-- Attachment #2: package_el.patch --]
[-- Type: application/octet-stream, Size: 2067 bytes --]

--- v27.090_package.el	2020-05-04 15:49:33.387845600 -0400
+++ package.el	2020-05-04 16:53:18.491017400 -0400
@@ -397,6 +397,24 @@
   :type 'boolean
   :version "25.1")
 
+(defcustom package-name-column-width 30
+  "Column width of the 'Package' name within the package list
+invoked through `package-list-packages'."
+  :type 'number
+  :version "27.1")
+
+(defcustom package-version-column-width 14
+  "Column width of the package 'version' within the package list
+invoked through `package-list-packages'."
+  :type 'number
+  :version "27.1")
+
+(defcustom package-status-column-width 12
+  "Column width of the package 'status' within the package list
+invoked from the `package-list-packages' command"
+  :type 'number
+  :version "27.1")
+
 \f
 ;;; `package-desc' object definition
 ;; This is the struct used internally to represent packages.
@@ -2750,16 +2768,16 @@
 
 (define-derived-mode package-menu-mode tabulated-list-mode "Package Menu"
   "Major mode for browsing a list of packages.
-Letters do not insert themselves; instead, they are commands.
-\\<package-menu-mode-map>
-\\{package-menu-mode-map}"
+  Letters do not insert themselves; instead, they are commands.
+  \\<package-menu-mode-map>
+  \\{package-menu-mode-map}"
   (setq mode-line-process '((package--downloads-in-progress ":Loading")
                             (package-menu--transaction-status
                              package-menu--transaction-status)))
   (setq tabulated-list-format
-        `[("Package" 18 package-menu--name-predicate)
-          ("Version" 13 package-menu--version-predicate)
-          ("Status"  10 package-menu--status-predicate)
+        `[("Package" ,package-name-column-width package-menu--name-predicate)
+          ("Version" ,package-version-column-width package-menu--version-predicate)
+          ("Status"  ,package-status-column-width  package-menu--status-predicate)
           ,@(if (cdr package-archives)
                 '(("Archive" 10 package-menu--archive-predicate)))
           ("Description" 0 package-menu--description-predicate)])

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

* bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
  2020-05-04 20:10 bug#41086: [PATCH] Add user-defined column widths to package-list (package.el) Chris McMahan
  2020-05-04 21:01 ` bug#41086: Corrcted patch for bug #41086 Chris McMahan
@ 2020-05-04 21:02 ` Stefan Kangas
       [not found]   ` <CAFgt8u2GWpZHnSevoGMQwVQP1x6n8mvRVFJEZbXW-iqM7qNaaw@mail.gmail.com>
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2020-05-04 21:02 UTC (permalink / raw)
  To: Chris McMahan, 41086

Chris McMahan <cmcmahan@gmail.com> writes:

> When executing the function `package-list-packages', the column widths are
> too narrow, cutting off a significant
> portion of the package names.
>
> This minor patch adds four variables that can be set by the user to adjust
> the width of each column within the package list.

Thanks for the patch, this makes sense.  I have some comments below.

Is this your first patch to Emacs?  I can't find your name in the git
log, but maybe I missed it.  Since your patch is over 15 lines, we
would need a copyright assignment from you to be able to apply it.
Would you be willing to sign such papers?

Please see here for more: https://www.gnu.org/licenses/why-assign.html

---

Now, here are my technical comments.

Could you send your patch as formatted by 'git format-patch -1'
instead?  It will make it easier for us to apply it.

> Changelog entry
> --------------------------------
> 2020-05-04  Chris McMahan  <cmcmahan@gmail.com>
>
> * package.el ((define-derived-mode package-menu-mode tabulated-list-mode
> "Package Menu"):
> User can now adjust column widths of the package list by setting the values
> of the following:

This is better formatted like:

* package.el (package-menu-mode): User can now adjust column widths of
the package list by setting the values of the below defcustoms.

> package-name-column-width (defaults to 30 columns)
> package-version-column-width (14 column)
> package-status-column-width (12 columns)
> package-archive-column-width (14 columns)

This should be formatted like so:

    (package-archive-column-width): New defcustom.

> +(defcustom package-name-column-width 30
> +  "Column width of the 'Package' name within the package list
> +invoked through `package-list-packages'."
> +  :type 'number
> +  :version "27.1")

Should be :version "28.1", since this will most likely not go to the
emacs-27 branch this close to the release.

Also the first line should be a complete sentence in this defcustom
and the others.  Please see M-x customize-group RET package RET if you
want to see why.

We prefer "package menu" to "package list".  I'm not sure why, but I
think it has historical reasons.  Ideal or not, I think we should try
to stay consistent.

Possibly the docstrings could look something much like:

"Column width for the Package name in the package menu."

Refer to Info node `(elisp) Documentation Tips' for more.

> -Letters do not insert themselves; instead, they are commands.
> -\\<package-menu-mode-map>
> -\\{package-menu-mode-map}"
> +  Letters do not insert themselves; instead, they are commands.
> +  \\<package-menu-mode-map>
> +  \\{package-menu-mode-map}"

Why this reformatting?  This will make the docstring look unusual in
C-h f, I think.

Thanks again for your patch.

Best regards,
Stefan Kangas





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

* bug#41086: Fwd: bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
       [not found]   ` <CAFgt8u2GWpZHnSevoGMQwVQP1x6n8mvRVFJEZbXW-iqM7qNaaw@mail.gmail.com>
@ 2020-05-05  1:39     ` Stefan Kangas
  2020-05-05 14:14       ` Eli Zaretskii
       [not found]     ` <87eerznyav.fsf@stefankangas.se>
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2020-05-05  1:39 UTC (permalink / raw)
  To: 41086

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

---------- Forwarded message ---------
Från: Chris McMahan <cmcmahan@gmail.com>
Date: mån 4 maj 2020 kl 23:53
Subject: Re: bug#41086: [PATCH] Add user-defined column widths to
package-list (package.el)
To: Stefan Kangas <stefankangas@gmail.com>


Hell Stefan,

Yes, this is my first patch. I've been implementing this fix in my
emacs configs for at least 5 years, just assuming someone else would
see it.

Thank you very much for you comments. They were most helpful.

I have no problem signing the copyright. I just need some guidance on
the process.

The revised patch is attached, made with the command
  git format-patch -1
against savannah.org repository.

The changelog entry follows:

* package.el (package-menu-mode): User can now adjust the column widths of
the package menu by setting the values of the following defcustoms.

(package-name-column-width) New defcustom
(package-version-column-width) New defcustom
(package-status-column-width) New defcustom



Hopefully, that covered all of the changes. Thanks again for your help!

- Chris McMahan


On Mon, May 4, 2020 at 5:03 PM Stefan Kangas <stefankangas@gmail.com> wrote:
>
> Chris McMahan <cmcmahan@gmail.com> writes:
>
> > When executing the function `package-list-packages', the column widths are
> > too narrow, cutting off a significant
> > portion of the package names.
> >
> > This minor patch adds four variables that can be set by the user to adjust
> > the width of each column within the package list.
>
> Thanks for the patch, this makes sense.  I have some comments below.
>
> Is this your first patch to Emacs?  I can't find your name in the git
> log, but maybe I missed it.  Since your patch is over 15 lines, we
> would need a copyright assignment from you to be able to apply it.
> Would you be willing to sign such papers?
>
> Please see here for more: https://www.gnu.org/licenses/why-assign.html
>
> ---
>
> Now, here are my technical comments.
>
> Could you send your patch as formatted by 'git format-patch -1'
> instead?  It will make it easier for us to apply it.
>
> > Changelog entry
> > --------------------------------
> > 2020-05-04  Chris McMahan  <cmcmahan@gmail.com>
> >
> > * package.el ((define-derived-mode package-menu-mode tabulated-list-mode
> > "Package Menu"):
> > User can now adjust column widths of the package list by setting the values
> > of the following:
>
> This is better formatted like:
>
> * package.el (package-menu-mode): User can now adjust column widths of
> the package list by setting the values of the below defcustoms.
>
> > package-name-column-width (defaults to 30 columns)
> > package-version-column-width (14 column)
> > package-status-column-width (12 columns)
> > package-archive-column-width (14 columns)
>
> This should be formatted like so:
>
>     (package-archive-column-width): New defcustom.
>
> > +(defcustom package-name-column-width 30
> > +  "Column width of the 'Package' name within the package list
> > +invoked through `package-list-packages'."
> > +  :type 'number
> > +  :version "27.1")
>
> Should be :version "28.1", since this will most likely not go to the
> emacs-27 branch this close to the release.
>
> Also the first line should be a complete sentence in this defcustom
> and the others.  Please see M-x customize-group RET package RET if you
> want to see why.
>
> We prefer "package menu" to "package list".  I'm not sure why, but I
> think it has historical reasons.  Ideal or not, I think we should try
> to stay consistent.
>
> Possibly the docstrings could look something much like:
>
> "Column width for the Package name in the package menu."
>
> Refer to Info node `(elisp) Documentation Tips' for more.
>
> > -Letters do not insert themselves; instead, they are commands.
> > -\\<package-menu-mode-map>
> > -\\{package-menu-mode-map}"
> > +  Letters do not insert themselves; instead, they are commands.
> > +  \\<package-menu-mode-map>
> > +  \\{package-menu-mode-map}"
>
> Why this reformatting?  This will make the docstring look unusual in
> C-h f, I think.
>
> Thanks again for your patch.
>
> Best regards,
> Stefan Kangas



-- 
Chris McMahan <cmcmahan@gmail.com>

[-- Attachment #2: 0001-Allow-user-to-adjust-column-widths-in-the-package-me.patch --]
[-- Type: application/x-patch, Size: 1962 bytes --]

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

* bug#41086: Fwd: bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
       [not found]       ` <CAFgt8u2CgqfwWQ2xraK=c9ceALC6VXksdFNV3wBvvV0sr1m+hw@mail.gmail.com>
@ 2020-05-05  1:39         ` Stefan Kangas
  2020-05-05  1:42         ` Stefan Kangas
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Kangas @ 2020-05-05  1:39 UTC (permalink / raw)
  To: 41086

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

---------- Forwarded message ---------
Från: Chris McMahan <cmcmahan@gmail.com>
Date: tis 5 maj 2020 kl 03:10
Subject: Re: bug#41086: [PATCH] Add user-defined column widths to
package-list (package.el)
To: Stefan Kangas <stefankangas@gmail.com>


Hello Stephan,

Revised patch file is attached.

- Chris

On Mon, May 4, 2020 at 6:13 PM Stefan Kangas <stefankangas@gmail.com> wrote:
>
> Hi Chris,
>
> Chris McMahan <cmcmahan@gmail.com> writes:
>
> > Yes, this is my first patch.
>
> Welcome to Emacs!  Let's hope we see more contributions from you in
> the future.
>
> > I have no problem signing the copyright. I just need some guidance on the
> > process.
>
> OK, great.  Eli, could you please help Chris get started with the
> process?
>
> > The changelog entry follows:
> >
> > * package.el (package-menu-mode): User can now adjust the column widths of
> > the package menu by setting the values of the following defcustoms.
> >
> > (package-name-column-width) New defcustom
> > (package-version-column-width) New defcustom
> > (package-status-column-width) New defcustom
>
> Thank you, but could you add this as part of the commit message?  See
> the file CONTRIBUTE for more, or previous commits in the git repository.
>
> > Subject: [PATCH] Allow user to adjust column widths in the package menu
>
> Maybe better: "Customizable column widths in package menu"
>
> Other than that, looks good to me.  We just have to wait for your
> copyright assignment to come through before we can push it.
>
> Thanks again.
>
> Best regards,
> Stefan Kangas



-- 
Chris McMahan <cmcmahan@gmail.com>

[-- Attachment #2: 0001-Allow-user-to-adjust-column-widths-in-the-package-me.patch --]
[-- Type: application/x-patch, Size: 1962 bytes --]

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

* bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
       [not found]       ` <CAFgt8u2CgqfwWQ2xraK=c9ceALC6VXksdFNV3wBvvV0sr1m+hw@mail.gmail.com>
  2020-05-05  1:39         ` Stefan Kangas
@ 2020-05-05  1:42         ` Stefan Kangas
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Kangas @ 2020-05-05  1:42 UTC (permalink / raw)
  To: Chris McMahan, 41086

Thanks.  Next time, please include 41086@debbugs.gnu.org in the
senders list so we can keep an archive of the discussion for
reference.  It should be enough to hit "Reply to all" in your email
client for it to work automatically.

For now, I forwarded your two most recent messages there.  You can
read the archive at:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41086

Best regards,
Stefan Kangas





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

* bug#41086: Fwd: bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
  2020-05-05  1:39     ` bug#41086: Fwd: " Stefan Kangas
@ 2020-05-05 14:14       ` Eli Zaretskii
       [not found]         ` <CAFgt8u018fvLKF8xWsUs5Ky1TLhSceSPJSuKhrFrgvcm_zOU8g@mail.gmail.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2020-05-05 14:14 UTC (permalink / raw)
  To: Stefan Kangas, Chris McMahan; +Cc: 41086

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Tue, 5 May 2020 03:39:09 +0200
> 
> The changelog entry follows:
> 
> * package.el (package-menu-mode): User can now adjust the column widths of
> the package menu by setting the values of the following defcustoms.
> 
> (package-name-column-width) New defcustom
> (package-version-column-width) New defcustom
> (package-status-column-width) New defcustom

Our style is slightly different, see CONTRIBUTE.  (Emacs actually has
commands that will help you format these log entries.)  It should look
like this in this case:

  Let user adjust the column widths of the package menu.
  * lisp/emacs-lisp/package.el (package-name-column-width)
  (package-version-column-width, package-status-column-width): New
  defcustoms.
  (package-menu-mode): Use the values of defcustoms instead of
  hardcoded values.  (Bug#41086)

> +(defcustom package-name-column-width 30
> +  "Column width for the Package name in the package menu."
> +  :type 'number
> +  :version "28.1")
> +
> +(defcustom package-version-column-width 14
> +  "Column width for the Package version in the package menu."
> +  :type 'number
> +  :version "28.1")
> +
> +(defcustom package-status-column-width 12
> +  "Column width for the Package status in the package menu."
> +  :type 'number
> +  :version "28.1")

These change the default values from the current hard-coded ones.  Any
reasons for that change?

>    (setq tabulated-list-format
> -        `[("Package" 18 package-menu--name-predicate)
> -          ("Version" 13 package-menu--version-predicate)
> -          ("Status"  10 package-menu--status-predicate)
> +        `[("Package" ,package-name-column-width package-menu--name-predicate)
> +          ("Version" ,package-version-column-width package-menu--version-predicate)
> +          ("Status"  ,package-status-column-width  package-menu--status-predicate)
>            ,@(if (cdr package-archives)
>                  '(("Archive" 10 package-menu--archive-predicate)))

Why do we leave the "Archive" column width hard-coded?

Also, I see 13 in at least 2 more places in the code, are they
related?  If so, they should be changed to use the defcustom as well.

Finally, I think this warrants a NEWS entry.

Thanks.





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

* bug#41086: Fwd: bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
       [not found]         ` <CAFgt8u018fvLKF8xWsUs5Ky1TLhSceSPJSuKhrFrgvcm_zOU8g@mail.gmail.com>
@ 2020-05-05 16:09           ` Eli Zaretskii
  2020-05-05 17:12             ` Chris McMahan
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2020-05-05 16:09 UTC (permalink / raw)
  To: Chris McMahan; +Cc: 41086

[Forwarding to everyone; please use Reply All.]

> From: Chris McMahan <cmcmahan@gmail.com>
> Date: Tue, 5 May 2020 11:28:13 -0400
> 
> Hi Eli,
> I hope I'm not being too difficult getting this set up.
> 
> The format for the patch commit message has been incorporated.
> 
> The other hardcoded values (13 in this case) are for aligning the labels and values in the package description
> page, and not related to the package-menu table that this patch covers.
> 
> On the question of the Archive column... I have been trying to figure out how to have the value of the variable
> substituted in to the list, rather than the variable name as a string.
> 
> Evaluating this code results in the following error:
> 
> [("Package" 30 package-menu--name-predicate) ("Version" 14 package-menu--version-predicate) ("Status"
> 12 package-menu--status-predicate) ("Archive" (\, package-archive-column-width)
> package-menu--archive-predicate) q ("Description" 0 package-menu--description-predicate)]
> 
>     (defcustom package-name-column-width 30
>       "Column width for the Package name in the package menu."
>       :type 'number
>       :version "28.1")
>     
>     (defcustom package-version-column-width 14
>       "Column width for the Package version in the package menu."
>       :type 'number
>       :version "28.1")
>     
>     (defcustom package-status-column-width 12
>       "Column width for the Package status in the package menu."
>       :type 'number
>       :version "28.1")
>     
>     (defcustom package-archive-column-width 12
>       "Column width for the Package status in the package menu."
>       :type 'number
>       :version "28.1")
>     
>     (setq tabulated-list-format
>           `[("Package" ,package-name-column-width package-menu--name-predicate)
>             ("Version" ,package-version-column-width package-menu--version-predicate)
>             ("Status"  ,package-status-column-width  package-menu--status-predicate)
>             ,@(if (cdr package-archives)
>                   '(("Archive" ,package-status-column-width package-menu--archive-predicate)))
>             ("Description" 0 package-menu--description-predicate)])
>    
> 
> I can't figure out how to get it to use the value of package-archive-column-width and not the string literal.
> 
> I'll hold off another patch to try to solve this one. Any help you could offer would be greatly appreciated!





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

* bug#41086: Fwd: bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
  2020-05-05 16:09           ` Eli Zaretskii
@ 2020-05-05 17:12             ` Chris McMahan
  2020-05-05 17:24               ` Noam Postavsky
  0 siblings, 1 reply; 11+ messages in thread
From: Chris McMahan @ 2020-05-05 17:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 41086

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

I may have found a solution.... but I have no idea if it's a decent one....

;; Original non-functioning code. Trying to get the value of the
package-archive-column-width into the list rather than hardcode it.
(setq tabulated-list-format
        `[("Package" ,package-name-column-width
package-menu--name-predicate)
          ("Version" ,package-version-column-width
package-menu--version-predicate)
          ("Status"  ,package-status-column-width
 package-menu--status-predicate)])
          ,@(if (cdr package-archives)
                '(("Archive" ,package-archive-column-width
package-menu--archive-predicate)))
          ("Description" 0 package-menu--description-predicate)])

;; potential solution.... any thoughts?
(setq tabulated-list-format
        `[("Package" ,package-name-column-width
package-menu--name-predicate)
          ("Version" ,package-version-column-width
package-menu--version-predicate)
          ("Status"  ,package-status-column-width
 package-menu--status-predicate)])
(if (cdr package-archives)
    (setq tabulated-list-format (append tabulated-list-format `(("Archive"
,package-archive-column-width package-menu--archive-predicate)))))
(setq tabulated-list-format (append tabulated-list-format `(("Description"
0 package-menu--description-predicate))))

- Chris


On Tue, May 5, 2020 at 12:09 PM Eli Zaretskii <eliz@gnu.org> wrote:

> [Forwarding to everyone; please use Reply All.]
>
> > From: Chris McMahan <cmcmahan@gmail.com>
> > Date: Tue, 5 May 2020 11:28:13 -0400
> >
> > Hi Eli,
> > I hope I'm not being too difficult getting this set up.
> >
> > The format for the patch commit message has been incorporated.
> >
> > The other hardcoded values (13 in this case) are for aligning the labels
> and values in the package description
> > page, and not related to the package-menu table that this patch covers.
> >
> > On the question of the Archive column... I have been trying to figure
> out how to have the value of the variable
> > substituted in to the list, rather than the variable name as a string.
> >
> > Evaluating this code results in the following error:
> >
> > [("Package" 30 package-menu--name-predicate) ("Version" 14
> package-menu--version-predicate) ("Status"
> > 12 package-menu--status-predicate) ("Archive" (\,
> package-archive-column-width)
> > package-menu--archive-predicate) q ("Description" 0
> package-menu--description-predicate)]
> >
> >     (defcustom package-name-column-width 30
> >       "Column width for the Package name in the package menu."
> >       :type 'number
> >       :version "28.1")
> >
> >     (defcustom package-version-column-width 14
> >       "Column width for the Package version in the package menu."
> >       :type 'number
> >       :version "28.1")
> >
> >     (defcustom package-status-column-width 12
> >       "Column width for the Package status in the package menu."
> >       :type 'number
> >       :version "28.1")
> >
> >     (defcustom package-archive-column-width 12
> >       "Column width for the Package status in the package menu."
> >       :type 'number
> >       :version "28.1")
> >
> >     (setq tabulated-list-format
> >           `[("Package" ,package-name-column-width
> package-menu--name-predicate)
> >             ("Version" ,package-version-column-width
> package-menu--version-predicate)
> >             ("Status"  ,package-status-column-width
> package-menu--status-predicate)
> >             ,@(if (cdr package-archives)
> >                   '(("Archive" ,package-status-column-width
> package-menu--archive-predicate)))
> >             ("Description" 0 package-menu--description-predicate)])
> >
> >
> > I can't figure out how to get it to use the value of
> package-archive-column-width and not the string literal.
> >
> > I'll hold off another patch to try to solve this one. Any help you could
> offer would be greatly appreciated!
>


-- 
*Chris McMahan <cmcmahan@gmail.com <cmcmahan@gmail.com>>*

[-- Attachment #2: Type: text/html, Size: 6202 bytes --]

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

* bug#41086: Fwd: bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
  2020-05-05 17:12             ` Chris McMahan
@ 2020-05-05 17:24               ` Noam Postavsky
  2020-05-05 17:54                 ` Chris McMahan
  0 siblings, 1 reply; 11+ messages in thread
From: Noam Postavsky @ 2020-05-05 17:24 UTC (permalink / raw)
  To: Chris McMahan; +Cc: 41086

Chris McMahan <cmcmahan@gmail.com> writes:

> ;; Original non-functioning code. Trying to get the value of the
> package-archive-column-width into the list rather than hardcode it.
> (setq tabulated-list-format
>         `[("Package" ,package-name-column-width
> package-menu--name-predicate)
>           ("Version" ,package-version-column-width
> package-menu--version-predicate)
>           ("Status"  ,package-status-column-width
>  package-menu--status-predicate)])
>           ,@(if (cdr package-archives)
>                 '(("Archive" ,package-archive-column-width
                  ^

You just need a backquote here instead of a plain quote.  A good rule of
thumb is that if you climb up (using backward-up-list, C-M-u) from a
comma, there should always be exactly one corresponding backquote per
comma.  In this case you had two commas, but only one backquote.

> (if (cdr package-archives)
>     (setq tabulated-list-format (append tabulated-list-format `(("Archive" ,package-archive-column-width package-menu--archive-predicate)))))
> (setq tabulated-list-format (append tabulated-list-format `(("Description" 0 package-menu--description-predicate))))

This works too, though it's a bit clunky.

>> > I can't figure out how to get it to use the value of
>> > package-archive-column-width and not the string literal.

FYI, you really mean a quoted symbol, not a string literal.





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

* bug#41086: Fwd: bug#41086: [PATCH] Add user-defined column widths to package-list (package.el)
  2020-05-05 17:24               ` Noam Postavsky
@ 2020-05-05 17:54                 ` Chris McMahan
  0 siblings, 0 replies; 11+ messages in thread
From: Chris McMahan @ 2020-05-05 17:54 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 41086

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

The backquote did the trick! (slaps forehead).

I appreciate the help!

- Chris

On Tue, May 5, 2020 at 1:24 PM Noam Postavsky <npostavs@gmail.com> wrote:

> Chris McMahan <cmcmahan@gmail.com> writes:
>
> > ;; Original non-functioning code. Trying to get the value of the
> > package-archive-column-width into the list rather than hardcode it.
> > (setq tabulated-list-format
> >         `[("Package" ,package-name-column-width
> > package-menu--name-predicate)
> >           ("Version" ,package-version-column-width
> > package-menu--version-predicate)
> >           ("Status"  ,package-status-column-width
> >  package-menu--status-predicate)])
> >           ,@(if (cdr package-archives)
> >                 '(("Archive" ,package-archive-column-width
>                   ^
>
> You just need a backquote here instead of a plain quote.  A good rule of
> thumb is that if you climb up (using backward-up-list, C-M-u) from a
> comma, there should always be exactly one corresponding backquote per
> comma.  In this case you had two commas, but only one backquote.
>
> > (if (cdr package-archives)
> >     (setq tabulated-list-format (append tabulated-list-format
> `(("Archive" ,package-archive-column-width
> package-menu--archive-predicate)))))
> > (setq tabulated-list-format (append tabulated-list-format
> `(("Description" 0 package-menu--description-predicate))))
>
> This works too, though it's a bit clunky.
>
> >> > I can't figure out how to get it to use the value of
> >> > package-archive-column-width and not the string literal.
>
> FYI, you really mean a quoted symbol, not a string literal.
>


-- 
*Chris McMahan <cmcmahan@gmail.com <cmcmahan@gmail.com>>*

[-- Attachment #2: Type: text/html, Size: 2819 bytes --]

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

end of thread, other threads:[~2020-05-05 17:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 20:10 bug#41086: [PATCH] Add user-defined column widths to package-list (package.el) Chris McMahan
2020-05-04 21:01 ` bug#41086: Corrcted patch for bug #41086 Chris McMahan
2020-05-04 21:02 ` bug#41086: [PATCH] Add user-defined column widths to package-list (package.el) Stefan Kangas
     [not found]   ` <CAFgt8u2GWpZHnSevoGMQwVQP1x6n8mvRVFJEZbXW-iqM7qNaaw@mail.gmail.com>
2020-05-05  1:39     ` bug#41086: Fwd: " Stefan Kangas
2020-05-05 14:14       ` Eli Zaretskii
     [not found]         ` <CAFgt8u018fvLKF8xWsUs5Ky1TLhSceSPJSuKhrFrgvcm_zOU8g@mail.gmail.com>
2020-05-05 16:09           ` Eli Zaretskii
2020-05-05 17:12             ` Chris McMahan
2020-05-05 17:24               ` Noam Postavsky
2020-05-05 17:54                 ` Chris McMahan
     [not found]     ` <87eerznyav.fsf@stefankangas.se>
     [not found]       ` <CAFgt8u2CgqfwWQ2xraK=c9ceALC6VXksdFNV3wBvvV0sr1m+hw@mail.gmail.com>
2020-05-05  1:39         ` Stefan Kangas
2020-05-05  1:42         ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).