I have the following situation: very long function names that are put into text with a macro \fun{this-is-a-very-long-fuction-name}. This macro includes indexing, but then finally puts the function name in bold as a hyperlink. I want to have LaTeX do line breaks for adjustment, but break the emboldened name only at the hyphens without adding a hyphen; the hyperlink must work. How can I do that? Specifically, my \fun macro is
\def\fun#1{\funbb{#1}{#1}\indexfun{#1}}
\def\funbb#1#2{\hyperlink{#1}{\textbf{#2}}}
\def\indexfun#1{\index{#1@\textbf{#1}}}
The rest of the document should have normal line breaks with adjustment and hyphenation.
Edit: Here is an example:
\documentclass{book}
\usepackage{geometry}
\usepackage{txfonts}
\usepackage[breaklinks]{hyperref}
\geometry{total={115.84mm,195mm}}
\def\fun#1{\hyperlink{#1}{\textbf{#1}}}
\begin{document}
we need to include the lengths of all months from Tishri until \fun{last-month-of-hebrew-year}
\end{document}
When compiled with latex, it produces the following in the DVI:
Note that it breaks the function name after the "he" of "hebrew". Also, it is not a hyperlink, as it should be.

latexand notpdflatex, as I was able to reproduce this only with the former. I have edited the question to include your example, and voted to reopen it. (BTW, there is a warning message in the output that says “Package hyperref Warning: You have enabled optionbreaklinks'. But driverhdvips.def' does not suppport this. Expect trouble with the link areas of broken links.”) – ShreevatsaR Jul 03 '17 at 19:50pdflatexinstead oflatexis the only solution I know of (and it solves both problems; also you don't need the[breaklinks]option as it's set automatically). I don't know if you have compelling reasons to go the DVI route; working around those reasons (so that you can directly produce PDF) may be easier than fixing this. Maybe someone with more knowledge of the inner workings of thehyperrefpackage will post an answer. – ShreevatsaR Jul 04 '17 at 02:35hdvipsdriver is used, discretionaries are not added after explicit hyphens, contrary to what normally happens (cf. The TeXbook, p. 286, sixth to fourth line from the bottom). Since the\hyphencharis not changed, in all probability this is achieved by typesetting the link in restricted horizontal mode and subsequently\unhboxing it; in any case, the lack of discretionaries fully explains the fact that the word “hebrew” gets hyphenated (see p. 454, esp. ll. -8 to -5). – GuM Jul 04 '17 at 20:34\pdf@rectinhdvips.def. – GuM Jul 04 '17 at 20:42breakurlpackage may have some clues… – ShreevatsaR Jul 04 '17 at 21:36pdflatex? – Andrew Swann Nov 05 '17 at 15:32