<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% This file is public domain
% If you want to use arara, you need the following directives:
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
%
%http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sample-chap-hyperfirst
\documentclass{report}

\usepackage[colorlinks]{hyperref}
\usepackage{glossaries}

\makeglossaries

\glsaddstoragekey{chapter}{0}{\glschapnum}

\loadglsentries{example-glossaries-brief}

\renewcommand*{\glslinkpostsetkeys}{%
 \edef\currentchap{\arabic{chapter}}%
 \ifnum\currentchap=\glschapnum{\glslabel}\relax
% Already used this entry in the current chapter, so switch
% off the hyperlink.
  \setkeys{glslink}{hyper=false}%
 \else
% Hasn't been used in the current chapter. Update the value
% of the "chapter" field unless the hyperlink has been switched
% off.
  \glsifhyperon
  {%
    \glsfieldxdef{\glslabel}{chapter}{\currentchap}%
  }%
  {}%
 \fi
}

\begin{document}
\chapter{Sample}

Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. }

Use them again:  \forglsentries{\thislabel}{\gls{\thislabel}. }

\chapter{Another}

Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. }

Use them again:  \forglsentries{\thislabel}{\gls{\thislabel}. }

\chapter{Start with a Star}

Use all entries but suppress hyperlink:
\forglsentries{\thislabel}{\gls*{\thislabel}. }

Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. }

Use them again:  \forglsentries{\thislabel}{\gls{\thislabel}. }

\printglossaries

\end{document}
</pre></body></html>