unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
@ 2018-04-04 10:55 Michael Heerdegen
  2018-04-11 20:47 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2018-04-04 10:55 UTC (permalink / raw)
  To: 31057


Hello,

It would be nice if there was a way to influence which articles are
shown when selecting a group in Gnus.  I recently discovered the Gnus
registry.  It would be cool if I could change the set of shown articles
based on the data in the registry (custom marks, for example).  I think
it could be something as simple as
`gnus-alter-articles-to-read-function', a variable bound to a function
that one can set or advice.


Thanks,

Michael.


In GNU Emacs 27.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version 3.22.29)
 of 2018-04-02 built on drachen
Repository revision: a8ea7cd40faa41e4ee6f862c8f685d53c6d390af
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux buster/sid

Recent messages:
Auto-saving...done
Auto-saving...done
Mark set
Auto-saving...done
Saving file /home/micha/Treasure/today/random-notes.txt...
Wrote /home/micha/Treasure/today/random-notes.txt
Auto-saving...done
Saving file /home/micha/Treasure/today/random-notes.txt...
Wrote /home/micha/Treasure/today/random-notes.txt
Making completion list... [17 times]

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 THREADS
JSON LCMS2

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_COLLATE: C
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  whitespace-mode: t
  ac-mode: t
  rainbow-delimiters-mode: t
  paredit-mode: t
  on-screen-global-mode: t
  ml-scale-mode: t
  helm-backup-mode: t
  el-search-hi-lock-mode: t
  interaction-log-mode: t
  highlight-defined-mode: t
  helm-autoresize-mode: t
  global-diff-hl-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  diff-auto-refine-mode: t
  smart-yank-mode: t
  recentf-mode: t
  savehist-mode: t
  which-function-mode: t
  winner-mode: t
  show-paren-mode: t
  auto-image-file-mode: t
  shell-dirtrack-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: my-prog-do-auto-fill

Load-path shadows:
/home/micha/gnu-emacs/elisp/linkd hides /home/micha/gnu-emacs/elisp/linkd/linkd
/home/micha/gnu-emacs/elisp/my-stuff/on-screen hides /home/micha/gnu-emacs/elisp/my-stuff/on-screen.el/on-screen
/home/micha/gnu-emacs/elisp/my-stuff/on-screen hides /home/micha/gnu-emacs/elisp/my-stuff/on-screen/on-screen
/home/micha/gnu-emacs/elisp/helm-swoop/helm-swoop hides /home/micha/.emacs.d/elpa/helm-swoop-20180215.354/helm-swoop
/home/micha/gnu-emacs/elisp/my-stuff/helm-backup/features/support/env hides /usr/local/share/emacs/27.0.50/lisp/env
/home/micha/.emacs.d/elpa/tabulated-list-20120406.1351/tabulated-list hides /usr/local/share/emacs/27.0.50/lisp/emacs-lisp/tabulated-list

Features:
(shadow sort bbdb-message footnote mail-extr emacsbug sendmail timeclock
misearch multi-isearch view cal-china lunar solar cal-dst cal-bahai
cal-islam cal-hebrew holidays hol-loaddefs nndoc nndraft nnmh gnus-agent
gnus-srvr gnus-score score-mode nnvirtual rot13 disp-table utf-7
gnus-cache network-stream starttls nntp gnorb gnorb-org gnorb-bbdb
gnorb-registry gnorb-gnus gnorb-utils org-capture org-attach org-id
nngnorb gnus-article-notes nnmairix nnml gnus-ml gnus-msg gnus-registry
registry eieio-base gnus-art mm-uu mml2015 mm-view mml-smime smime dig
hl-line helm-x-files helm-for-files hide-region org-rmail org-mhe
org-irc org-info org-gnus nnir gnus-sum gnus-group gnus-undo gnus-start
gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int
gnus-range gnus-win gnus nnheader org-docview org-bibtex bibtex
whitespace flyspell ispell elec-pair org-bbdb org-w3m org-agenda ac
icomplete default-dark-theme cus-theme bbdb-anniv bbdb-com bbdb
bbdb-site yagoc windresize windmove w3m doc-view image-mode timezone
w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image
w3m-proc w3m-util undo-tree diff rainbow-delimiters paredit orglink
on-screen hexrgb face-remap ml-scale helm-backup s vc-git linkd
el-search-hi-lock hi-lock el-search-pp el-search-x elisp-hacker-tools
interaction-log highlight-defined highlight frame-fns avoid helm-browse
cus-edit cus-start cus-load helm-dictionary helm-sys helm-external
helm-lacarte lacarte helm-descbinds helm-ring helm-misc helm-config
helm-easymenu helm-command helm-mode helm-man helm-imenu helm-elisp
helm-eval edebug helm-bookmark helm-net helm-adaptive helm-info
magit-bookmark bookmark helm-org helm-files helm-tags helm-locate
helm-buffers helm-grep wgrep-helm wgrep grep compile helm-regexp
helm-utils helm-types helm-help helm helm-source eieio-compat
helm-multi-match helm-lib fracy folding-isearch folding emacs-lock+
emacs-lock diff-hl vc-dir ewoc vc vc-dispatcher centered-cursor-mode
autofold apt-utils edmacro kmacro jka-compr browse-url vdiff-magit
magit-ediff magit-obsolete magit-blame magit-stash magit-bisect
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-collab ghub
url-http tls gnutls url-gw nsm url-auth url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf mailcap
let-alist magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log magit-diff magit-core magit-autorevert
autorevert filenotify magit-process magit-margin magit-mode git-commit
magit-git magit-section magit-utils crm magit-popup log-edit message
puny rfc822 mml mml-sec gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log with-editor cl-extra async-bytecomp async dash vdiff
smerge-mode hydra lv diff-mode smart-yank server rect tramp-cache
tramp-sh recentf tree-widget wid-edit foldout org-protocol org-element
avl-tree org org-macro org-footnote org-pcomplete org-list org-faces
org-entities org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs ls-lisp ibuffer ibuffer-loaddefs tramp-archive
tramp-gvfs zeroconf url-util dbus xml filecache em-dirs esh-var esh-cmd
esh-opt esh-io esh-ext esh-proc esh-arg esh-groups eshell esh-module
esh-mode esh-util ediff-x ediff-merg ediff-wind ediff-diff ediff-mult
ediff-help ediff-init ediff-util ediff el-search noutline outline
easy-mmode hideshow help-fns help-mode stream-x stream thunk cl-print
pcase rmc dired-x dired-aux find-dired dired dired-loaddefs appt
diary-lib diary-loaddefs diary-general cal-iso cal-menu calendar
cal-loaddefs epa-file epa derived epg savehist which-func imenu time
winner time-date paren delsel image-file debug tramp trampver
tramp-compat tramp-loaddefs ucs-normalize shell pcomplete comint
ansi-color ring parse-time format-spec advice iso-transl pp thingatpt
finder find-func rx automenu loadhist iterators generator mh-elisp-utils
subr-x autoload radix-tree lisp-mnt warnings mule-util tex-site cl
quarter-plane-autoloads vline-autoloads info finder-inf package easymenu
epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 1212145 158996)
 (symbols 48 62697 3)
 (miscs 40 7036 2201)
 (strings 32 332364 10496)
 (string-bytes 1 11516202)
 (vectors 16 107244)
 (vector-slots 8 2339298 245432)
 (floats 8 1171 1145)
 (intervals 56 2174 1055)
 (buffers 992 34))





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

* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
  2018-04-04 10:55 bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group Michael Heerdegen
@ 2018-04-11 20:47 ` Lars Ingebrigtsen
  2018-04-12  9:34   ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-11 20:47 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 31057

Michael Heerdegen <michael_heerdegen@web.de> writes:

> It would be nice if there was a way to influence which articles are
> shown when selecting a group in Gnus.  I recently discovered the Gnus
> registry.  It would be cool if I could change the set of shown articles
> based on the data in the registry (custom marks, for example).  I think
> it could be something as simple as
> `gnus-alter-articles-to-read-function', a variable bound to a function
> that one can set or advice.

But isn't that what the `gnus-alter-articles-to-read-function' variable
does?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
  2018-04-11 20:47 ` Lars Ingebrigtsen
@ 2018-04-12  9:34   ` Michael Heerdegen
  2018-04-12 11:40     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2018-04-12  9:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 31057

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > It would be nice if there was a way to influence which articles are
> > shown when selecting a group in Gnus.  I recently discovered the Gnus
> > registry.  It would be cool if I could change the set of shown articles
> > based on the data in the registry (custom marks, for example).  I think
> > it could be something as simple as
> > `gnus-alter-articles-to-read-function', a variable bound to a function
> > that one can set or advice.
>
> But isn't that what the `gnus-alter-articles-to-read-function' variable
> does?

That's what I also expected, but it doesn't seem to be the case.  I
installed an advice for gnus-alter-articles-to-read-function, and also
verified that the advice worked correctly, but it didn't do that.  After
reading the code a bit, I got the impression that
`gnus-alter-articles-to-read-function' is for controlling what articles
are fetched (additionally) from the server, but not which are shown in
the summary.


Michael.





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

* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
  2018-04-12  9:34   ` Michael Heerdegen
@ 2018-04-12 11:40     ` Lars Ingebrigtsen
  2018-04-12 12:26       ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-12 11:40 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 31057

Michael Heerdegen <michael_heerdegen@web.de> writes:

> That's what I also expected, but it doesn't seem to be the case.  I
> installed an advice for gnus-alter-articles-to-read-function, and also
> verified that the advice worked correctly, but it didn't do that.  After
> reading the code a bit, I got the impression that
> `gnus-alter-articles-to-read-function' is for controlling what articles
> are fetched (additionally) from the server, but not which are shown in
> the summary.

Well, you're not supposed to advice
`gnus-alter-articles-to-read-function', but instead set it to a function
that returns a new list of articles (based on the list that's passed
in).  And as far as I can tell from reading the code, the list returned
is the list of articles Gnus will fetch from the server (and then
display, depending on whether you have other filters in place).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
  2018-04-12 11:40     ` Lars Ingebrigtsen
@ 2018-04-12 12:26       ` Michael Heerdegen
  2018-04-12 13:09         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2018-04-12 12:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 31057

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Well, you're not supposed to advice
> `gnus-alter-articles-to-read-function', but instead set it to a
> function that returns a new list of articles (based on the list that's
> passed in).

No, the doc clearly says

| [...] Use `add-function' to set one or more custom filter functions.

That's what I did:

#+begin_src emacs-lisp
(add-function :around gnus-alter-articles-to-read-function
              (defun my-gnus-auto-show-registry-marked (f group-name article-list)
                (cl-union
                 (delq nil
                       (mapcar (lambda (id) (cdr (gnus-request-head id group-name)))
                               (cl-loop for key being the hash-keys of (oref gnus-registry-db data)
                                        using (hash-values v)
                                        when (assoc 'mark v)
                                        collect key)))
                 (funcall f group-name article-list))))
#+end_src

AFAIR Eric Abrahamsen and I decided that we want the thing to be
customizable like that, because it's then possible that different modes
can `add-function' stuff onto the variable to control things in
different ways.

> And as far as I can tell from reading the code, the list returned is
> the list of articles Gnus will fetch from the server

Yes.

> (And then display, depending on whether you have other filters in
> place).

Hmm, the additional articles (articles with attached custom marks in my
case) are not displayed for me.  AFAICT I have no filters enabled at
all.  When the registry marked articles are "old" they are just not
shown AFAICT.


Michael.





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

* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
  2018-04-12 12:26       ` Michael Heerdegen
@ 2018-04-12 13:09         ` Lars Ingebrigtsen
  2018-04-13 12:16           ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-12 13:09 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 31057

Michael Heerdegen <michael_heerdegen@web.de> writes:

> No, the doc clearly says
>
> | [...] Use `add-function' to set one or more custom filter functions.

I see.  I'm not familiar with the way nadvice works at all.  Have you
checked that the list of articles that's finally returned is the one you
expect?

>> (And then display, depending on whether you have other filters in
>> place).
>
> Hmm, the additional articles (articles with attached custom marks in my
> case) are not displayed for me.  AFAICT I have no filters enabled at
> all.  When the registry marked articles are "old" they are just not
> shown AFAICT.

Try edebugging through  gnus-select-newsgroup to see whether there's
anything there that removes the list you've returned (if you've returned
it. :-)).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
  2018-04-12 13:09         ` Lars Ingebrigtsen
@ 2018-04-13 12:16           ` Michael Heerdegen
  2018-04-13 12:33             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2018-04-13 12:16 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 31057

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I see.  I'm not familiar with the way nadvice works at all.

You should definitely have a look!

> Have you checked that the list of articles that's finally returned is
> the one you expect?

Yes, I think so.


> Try edebugging through gnus-select-newsgroup to see whether there's
> anything there that removes the list you've returned (if you've
> returned it. :-)).

Hmm - ehhm - it suddenly works as expected!

But I did not change anything in my config.  I switched from emacs-26 to
master since my report, and the registry corruption has been fixed -
dunno if that made the difference.

So, I guess you can close this report.  I can reopen it when the issue
reappears.


For the record, I changed my code to

#+begin_src emacs-lisp
(add-function :around gnus-alter-articles-to-read-function
              (defun my-gnus-auto-show-registry-marked (f group-name article-list)
                (cl-union
                 (delq nil
                       (mapcar (lambda (id) (cdr (gnus-request-head id group-name)))
                               (cl-loop for key being the hash-keys of (oref gnus-registry-db data)
                                        using (hash-values v)
                                        when (cdr (assoc 'mark v))
                                        collect key)))
                 (funcall f group-name article-list))))
#+end_src

to look at the cdr of (assoc 'mark v) because when you delete a custom
mark, this leaves over an association like (Note) for me, which the
first version I had posted erroneously interpreted as "custom mark
present".


Thanks,

Michael.





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

* bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group
  2018-04-13 12:16           ` Michael Heerdegen
@ 2018-04-13 12:33             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-13 12:33 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 31057

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Hmm - ehhm - it suddenly works as expected!

:-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2018-04-13 12:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-04 10:55 bug#31057: 27.0.50; Gnus: Make configurable what to show when selecting a group Michael Heerdegen
2018-04-11 20:47 ` Lars Ingebrigtsen
2018-04-12  9:34   ` Michael Heerdegen
2018-04-12 11:40     ` Lars Ingebrigtsen
2018-04-12 12:26       ` Michael Heerdegen
2018-04-12 13:09         ` Lars Ingebrigtsen
2018-04-13 12:16           ` Michael Heerdegen
2018-04-13 12:33             ` Lars Ingebrigtsen

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).