# HG changeset patch # User Roland Winkler # Date 1146094474 0 # Node ID 5d4423d8a6f52f7d7753395d2855935d82954248 # Parent eb2b6bd1c6f00bc9b1cdd5767f702fc04c75f44e (bibtex-url): New optional arg no-browse. Return the URL or nil if none can be generated. diff -r eb2b6bd1c6f0 -r 5d4423d8a6f5 lisp/textmodes/bibtex.el --- a/lisp/textmodes/bibtex.el Wed Apr 26 23:32:39 2006 +0000 +++ b/lisp/textmodes/bibtex.el Wed Apr 26 23:34:34 2006 +0000 @@ -4331,11 +4331,12 @@ "\n") (goto-char endpos))) -(defun bibtex-url (&optional pos) +(defun bibtex-url (&optional pos no-browse) "Browse a URL for the BibTeX entry at point. Optional POS is the location of the BibTeX entry. The URL is generated using the schemes defined in `bibtex-generate-url-list' -\(see there\). Then the URL is passed to `browse-url'." +\(see there\). Then the URL is passed to `browse-url' unless NO-BROWSE is nil. +Return the URL or nil if none can be generated." (interactive) (save-excursion (if pos (goto-char pos)) @@ -4370,8 +4371,10 @@ (error "Match failed: %s" field))) (if fmt (apply 'format fmt (nreverse obj)) (apply 'concat (nreverse obj))))) - (browse-url (message "%s" url)))) - (unless url (message "No URL known."))))) + (if (interactive-p) (message "%s" url)) + (unless no-browse (browse-url url)))) + (if (and (not url) (interactive-p)) (message "No URL known.")) + url))) ;; Make BibTeX a Feature