* Customizing %[, %] and fill width @ 2020-11-24 12:54 Pankaj Jangid 2020-11-25 12:57 ` Lars Ingebrigtsen 0 siblings, 1 reply; 5+ messages in thread From: Pankaj Jangid @ 2020-11-24 12:54 UTC (permalink / raw) To: Gnus Users I am customizing summary line format to please my eyes. So far it is going really really great. Just two queries that I need answer for: Value of my `gnus-summary-line-format' is "%U%R%z %[%-18,18&user-date;│%4L:%-25,25f%] %B%s\n" 1. %[%] produce contextual output either `[]' or `<>' depending upon whether the entry is real child or adopted. Is there a way to customize these two output values? 2. The above value of `gnus-summary-line-format' product perfectly aligned output; except when the sender name is non-english. In that case, the placement of [] or <> is not in alignment with other entries above and below. Is there a way to handle that? Thanks for help. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Customizing %[, %] and fill width 2020-11-24 12:54 Customizing %[, %] and fill width Pankaj Jangid @ 2020-11-25 12:57 ` Lars Ingebrigtsen 2020-11-25 19:14 ` Pankaj Jangid 0 siblings, 1 reply; 5+ messages in thread From: Lars Ingebrigtsen @ 2020-11-25 12:57 UTC (permalink / raw) To: Gnus Users Pankaj Jangid <pankaj.jangid@gmail.com> writes: > I am customizing summary line format to please my eyes. So far it is > going really really great. Just two queries that I need answer for: > > Value of my `gnus-summary-line-format' is > "%U%R%z %[%-18,18&user-date;│%4L:%-25,25f%] %B%s\n" > > 1. %[%] produce contextual output either `[]' or `<>' depending upon > whether the entry is real child or adopted. Is there a way to customize > these two output values? Nope: (defun gnus-summary-insert-line (header level current undownloaded [...] (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[)) (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\])) Patches to fix this are welcome. > 2. The above value of `gnus-summary-line-format' product perfectly > aligned output; except when the sender name is non-english. In that > case, the placement of [] or <> is not in alignment with other entries > above and below. Is there a way to handle that? If you choose fonts where all characters have widths that are multiples of each other, then things will align, but otherwise not. I don't think there's any way to get an aligned summary buffer, realistically. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Customizing %[, %] and fill width 2020-11-25 12:57 ` Lars Ingebrigtsen @ 2020-11-25 19:14 ` Pankaj Jangid [not found] ` <87eekgxv9i.fsf@gnus.org> 0 siblings, 1 reply; 5+ messages in thread From: Pankaj Jangid @ 2020-11-25 19:14 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Gnus Users [-- Attachment #1: Type: text/plain, Size: 556 bytes --] Lars Ingebrigtsen <larsi@gnus.org> writes: >> 1. %[%] produce contextual output either `[]' or `<>' depending upon >> whether the entry is real child or adopted. Is there a way to customize >> these two output values? > (defun gnus-summary-insert-line (header level current undownloaded > [...] > (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[)) > (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\])) > > Patches to fix this are welcome. This is working on my build. Is this patch acceptable? Should I submit it via M-x submit-emacs-patch? [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-New-user-options-to-customise-the-summary-line-specs.patch --] [-- Type: text/x-patch, Size: 6234 bytes --] From 4b4d68f8a15fd9481304344c041e1c6b4f148125 Mon Sep 17 00:00:00 2001 From: Pankaj Jangid <pankaj@codeisgreat.org> Date: Thu, 26 Nov 2020 00:34:48 +0530 Subject: [PATCH] New user options to customise the summary line specs %[ and %]. Four new options are introduced - 'gnus-sum-opening-bracket', 'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and 'gnus-sum-closing-bracket-adopted'. * doc/misc/gnus.text: documentation added for the new options * etc/NEWS: entry for new options * lisp/gnus/gnus-sum.el: implementation for new options --- doc/misc/gnus.texi | 31 +++++++++++++++++++++++++++-- etc/NEWS | 13 ++++++++++++ lisp/gnus/gnus-sum.el | 46 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 80 insertions(+), 10 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 81ce13945c..0aa881ba12 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -5028,10 +5028,37 @@ Summary Buffer Lines pushes everything after it off the screen). @item [ Opening bracket, which is normally @samp{[}, but can also be @samp{<} -for adopted articles (@pxref{Customizing Threading}). +for adopted articles (@pxref{Customizing Threading}). This can be +customized using following settings: + +@table @code +@item gnus-sum-opening-bracket +@vindex gnus-sum-opening-bracket +Opening bracket for normal (non-adopted) articles. The default is +@samp{[}. + +@item gnus-sum-opening-bracket-adopted +@vindex gnus-sum-opening-bracket-adopted +Opening bracket for adopted articles. The default is @samp{<}. + +@end table + @item ] Closing bracket, which is normally @samp{]}, but can also be @samp{>} -for adopted articles. +for adopted articles. This can be customised using following settings: + +@table @code +@item gnus-sum-closing-bracket +@vindex gnus-sum-closing-bracket +Closing bracket for normal (non-adopted) articles. The default is +@samp{]}. + +@item gnus-sum-closing-bracket-adopted +@vindex gnus-sum-opening-bracket-adopted +Closing bracket for adopted articles. The default is @samp{>}. + +@end table + @item > One space for each thread level. @item < diff --git a/etc/NEWS b/etc/NEWS index 9091643da5..18fdb6121a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -488,6 +488,19 @@ tags to be considered as well. ** Gnus ++++ +*** New user options to customise the summary line specs %[ and %]. +Four new options introduced in customisation group +'gnus-summary-format'. These are 'gnus-sum-opening-bracket', +'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and +'gnus-sum-closing-bracket-adopted'. Their default values are '[', ']', +'<', '>' respectively. These variables control the appearance of '%[' +and '%]' specs in the summary line format. '%[' will normally display +the value of 'gnus-sum-opening-bracket', but can also be +'gnus-sum-opening-bracket-adopted' for the adopted articles. '%]' will +normally display the value of 'gnus-sum-closing-bracket', but can also +be 'gnus-sum-closing-bracket-adopted' for the adopted articles. + +++ *** New user option 'gnus-paging-select-next'. This controls what happens when using commands like `SPC' and `DEL' to diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 469fa36fb7..c5943cebaf 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1460,8 +1460,8 @@ gnus-summary-line-format-alist (?I gnus-tmp-indentation ?s) (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s) (?R gnus-tmp-replied ?c) - (?\[ gnus-tmp-opening-bracket ?c) - (?\] gnus-tmp-closing-bracket ?c) + (?\[ gnus-tmp-opening-bracket ?s) + (?\] gnus-tmp-closing-bracket ?s) (?\> (make-string gnus-tmp-level ? ) ?s) (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s) (?i gnus-tmp-score ?d) @@ -3748,6 +3748,30 @@ gnus-summary-from-or-to-or-newsgroups (inline (gnus-summary-extract-address-component gnus-tmp-from)))))) +(defcustom gnus-sum-opening-bracket "[" + "With %[ spec, used to identify normal (non-adopted) articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + +(defcustom gnus-sum-closing-bracket "]" + "With %] spec, used to identify normal (non-adopted) articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + +(defcustom gnus-sum-opening-bracket-adopted "{" + "With %[ spec, used to identify adopted articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + +(defcustom gnus-sum-closing-bracket-adopted "}" + "With %] spec, used to identify adopted articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + (defun gnus-summary-insert-line (header level current undownloaded unread replied expirable subject-or-nil &optional dummy score process) @@ -3805,8 +3829,14 @@ gnus-summary-insert-line (1+ (match-beginning 0)) (1- (match-end 0)))) (t gnus-tmp-from))) (gnus-tmp-subject (mail-header-subject gnus-tmp-header)) - (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[)) - (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\])) + (gnus-tmp-opening-bracket + (if gnus-tmp-dummy + gnus-sum-opening-bracket-adopted + gnus-sum-opening-bracket)) + (gnus-tmp-closing-bracket + (if gnus-tmp-dummy + gnus-sum-closing-bracket-adopted + gnus-sum-closing-bracket)) (inhibit-read-only t)) (when (string= gnus-tmp-name "") (setq gnus-tmp-name gnus-tmp-from)) @@ -5439,10 +5469,10 @@ gnus-summary-prepare-threads (if (and (eq gnus-summary-make-false-root 'adopt) (= gnus-tmp-level 1) (memq number gnus-tmp-gathered)) - (setq gnus-tmp-opening-bracket ?\< - gnus-tmp-closing-bracket ?\>) - (setq gnus-tmp-opening-bracket ?\[ - gnus-tmp-closing-bracket ?\])) + (setq gnus-tmp-opening-bracket gnus-sum-opening-bracket-adopted + gnus-tmp-closing-bracket gnus-sum-closing-bracket-adopted) + (setq gnus-tmp-opening-bracket gnus-sum-opening-bracket + gnus-tmp-closing-bracket gnus-sum-closing-bracket)) (if (>= gnus-tmp-level (length gnus-thread-indent-array)) (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array)) -- 2.29.2 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <87eekgxv9i.fsf@gnus.org>]
[parent not found: <m2pn40tl3n.fsf@codeisgreat.org>]
[parent not found: <87h7pcuza8.fsf@gnus.org>]
* Re: Customizing %[, %] and fill width [not found] ` <87h7pcuza8.fsf@gnus.org> @ 2020-12-12 5:22 ` Pankaj Jangid 2020-12-12 10:47 ` Lars Ingebrigtsen 0 siblings, 1 reply; 5+ messages in thread From: Pankaj Jangid @ 2020-12-12 5:22 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Gnus Users [-- Attachment #1: Type: text/plain, Size: 436 bytes --] Lars Ingebrigtsen <larsi@gnus.org> writes: >> I am definitely willing to sign the papers. Please let me know the >> process. > > Great! (Form sent off-list.) > > When the process has completed, please send a mail reminding me to push > this patch. Hi Lars, Got the signed paper. Yeah! Attached is the patch rebased with ‘master’. I have been doing it daily to prevent merging issues at the last moment. :-) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-New-user-options-to-customise-the-summary-line-specs.patch --] [-- Type: text/x-patch, Size: 6234 bytes --] From a67e7c9803fe24b8f235a507cc3d2f203b7c6bc5 Mon Sep 17 00:00:00 2001 From: Pankaj Jangid <pankaj@codeisgreat.org> Date: Fri, 27 Nov 2020 00:33:25 +0530 Subject: [PATCH] New user options to customise the summary line specs %[ and %]. Four new options are introduced - 'gnus-sum-opening-bracket', 'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and 'gnus-sum-closing-bracket-adopted'. * doc/misc/gnus.text: documentation added for the new options * etc/NEWS: entry for new options * lisp/gnus/gnus-sum.el: implementation for new options --- doc/misc/gnus.texi | 31 +++++++++++++++++++++++++++-- etc/NEWS | 13 ++++++++++++ lisp/gnus/gnus-sum.el | 46 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 80 insertions(+), 10 deletions(-) diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 4aa07ce388..3d04f170bb 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -5028,10 +5028,37 @@ Summary Buffer Lines pushes everything after it off the screen). @item [ Opening bracket, which is normally @samp{[}, but can also be @samp{<} -for adopted articles (@pxref{Customizing Threading}). +for adopted articles (@pxref{Customizing Threading}). This can be +customized using following settings: + +@table @code +@item gnus-sum-opening-bracket +@vindex gnus-sum-opening-bracket +Opening bracket for normal (non-adopted) articles. The default is +@samp{[}. + +@item gnus-sum-opening-bracket-adopted +@vindex gnus-sum-opening-bracket-adopted +Opening bracket for adopted articles. The default is @samp{<}. + +@end table + @item ] Closing bracket, which is normally @samp{]}, but can also be @samp{>} -for adopted articles. +for adopted articles. This can be customised using following settings: + +@table @code +@item gnus-sum-closing-bracket +@vindex gnus-sum-closing-bracket +Closing bracket for normal (non-adopted) articles. The default is +@samp{]}. + +@item gnus-sum-closing-bracket-adopted +@vindex gnus-sum-opening-bracket-adopted +Closing bracket for adopted articles. The default is @samp{>}. + +@end table + @item > One space for each thread level. @item < diff --git a/etc/NEWS b/etc/NEWS index 26e4b8514f..5a4a89245f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -510,6 +510,19 @@ tags to be considered as well. ** Gnus ++++ +*** New user options to customise the summary line specs %[ and %]. +Four new options introduced in customisation group +'gnus-summary-format'. These are 'gnus-sum-opening-bracket', +'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and +'gnus-sum-closing-bracket-adopted'. Their default values are '[', ']', +'<', '>' respectively. These variables control the appearance of '%[' +and '%]' specs in the summary line format. '%[' will normally display +the value of 'gnus-sum-opening-bracket', but can also be +'gnus-sum-opening-bracket-adopted' for the adopted articles. '%]' will +normally display the value of 'gnus-sum-closing-bracket', but can also +be 'gnus-sum-closing-bracket-adopted' for the adopted articles. + +++ *** New user option 'gnus-paging-select-next'. This controls what happens when using commands like 'SPC' and 'DEL' to diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 9432eefcb4..9488b32487 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1460,8 +1460,8 @@ gnus-summary-line-format-alist (?I gnus-tmp-indentation ?s) (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s) (?R gnus-tmp-replied ?c) - (?\[ gnus-tmp-opening-bracket ?c) - (?\] gnus-tmp-closing-bracket ?c) + (?\[ gnus-tmp-opening-bracket ?s) + (?\] gnus-tmp-closing-bracket ?s) (?\> (make-string gnus-tmp-level ? ) ?s) (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s) (?i gnus-tmp-score ?d) @@ -3748,6 +3748,30 @@ gnus-summary-from-or-to-or-newsgroups (inline (gnus-summary-extract-address-component gnus-tmp-from)))))) +(defcustom gnus-sum-opening-bracket "[" + "With %[ spec, used to identify normal (non-adopted) articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + +(defcustom gnus-sum-closing-bracket "]" + "With %] spec, used to identify normal (non-adopted) articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + +(defcustom gnus-sum-opening-bracket-adopted "<" + "With %[ spec, used to identify adopted articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + +(defcustom gnus-sum-closing-bracket-adopted ">" + "With %] spec, used to identify adopted articles." + :version "28.1" + :type 'string + :group 'gnus-summary-format) + (defun gnus-summary-insert-line (header level current undownloaded unread replied expirable subject-or-nil &optional dummy score process) @@ -3805,8 +3829,14 @@ gnus-summary-insert-line (1+ (match-beginning 0)) (1- (match-end 0)))) (t gnus-tmp-from))) (gnus-tmp-subject (mail-header-subject gnus-tmp-header)) - (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[)) - (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\])) + (gnus-tmp-opening-bracket + (if gnus-tmp-dummy + gnus-sum-opening-bracket-adopted + gnus-sum-opening-bracket)) + (gnus-tmp-closing-bracket + (if gnus-tmp-dummy + gnus-sum-closing-bracket-adopted + gnus-sum-closing-bracket)) (inhibit-read-only t)) (when (string= gnus-tmp-name "") (setq gnus-tmp-name gnus-tmp-from)) @@ -5439,10 +5469,10 @@ gnus-summary-prepare-threads (if (and (eq gnus-summary-make-false-root 'adopt) (= gnus-tmp-level 1) (memq number gnus-tmp-gathered)) - (setq gnus-tmp-opening-bracket ?\< - gnus-tmp-closing-bracket ?\>) - (setq gnus-tmp-opening-bracket ?\[ - gnus-tmp-closing-bracket ?\])) + (setq gnus-tmp-opening-bracket gnus-sum-opening-bracket-adopted + gnus-tmp-closing-bracket gnus-sum-closing-bracket-adopted) + (setq gnus-tmp-opening-bracket gnus-sum-opening-bracket + gnus-tmp-closing-bracket gnus-sum-closing-bracket)) (if (>= gnus-tmp-level (length gnus-thread-indent-array)) (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array)) -- 2.29.2 [-- Attachment #3: Type: text/plain, Size: 26 bytes --] -- Regards Pankaj Jangid ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Customizing %[, %] and fill width 2020-12-12 5:22 ` Pankaj Jangid @ 2020-12-12 10:47 ` Lars Ingebrigtsen 0 siblings, 0 replies; 5+ messages in thread From: Lars Ingebrigtsen @ 2020-12-12 10:47 UTC (permalink / raw) To: Gnus Users Pankaj Jangid <pankaj@codeisgreat.org> writes: > Got the signed paper. Yeah! > > Attached is the patch rebased with ‘master’. I have been doing it daily > to prevent merging issues at the last moment. :-) :-) Thanks; I've now applied your patch to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-12 10:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-11-24 12:54 Customizing %[, %] and fill width Pankaj Jangid 2020-11-25 12:57 ` Lars Ingebrigtsen 2020-11-25 19:14 ` Pankaj Jangid [not found] ` <87eekgxv9i.fsf@gnus.org> [not found] ` <m2pn40tl3n.fsf@codeisgreat.org> [not found] ` <87h7pcuza8.fsf@gnus.org> 2020-12-12 5:22 ` Pankaj Jangid 2020-12-12 10:47 ` Lars Ingebrigtsen
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 NNTP newsgroup(s).