Skip to content

Instantly share code, notes, and snippets.

@gnusosa
Created August 20, 2014 22:09
Show Gist options
  • Select an option

  • Save gnusosa/bfce10bd40b207d13fd6 to your computer and use it in GitHub Desktop.

Select an option

Save gnusosa/bfce10bd40b207d13fd6 to your computer and use it in GitHub Desktop.
(defvar gnus-user-format-function-g-prev "" "")
(defun empty-common-prefix (left right)
"Given `left' '(\"foo\" \"bar\" \"fie\") and `right' '(\"foo\"
\"bar\" \"fum\"), return '(\" \" \" \" \"fum\")."
(if (and (cdr right) ; always keep the last part of right
(equal (car left) (car right)))
(cons (make-string (length (car left)) ? )
(empty-common-prefix (cdr left) (cdr right)))
right))
(defun gnus-user-format-function-g (arg)
"The full group name, but if it starts with a previously seen
prefix, empty that prefix."
(if (equal gnus-user-format-function-g-prev gnus-tmp-group) ; line-format is updated on exiting the summary, making prev equal this
gnus-tmp-group
(let* ((prev (split-string-and-unquote gnus-user-format-function-g-prev "\\."))
(this (split-string-and-unquote gnus-tmp-group "\\.")))
(setq gnus-user-format-function-g-prev gnus-tmp-group)
(combine-and-quote-strings
(empty-common-prefix prev this)
"."))))
(setq gnus-group-line-format "%M%S%p%P%5y:%B%(%ug%)\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment