During my LaTeX typesetting I need to "visually" check if URLs point to reacheable pages. I'd like to do it with lynx in a separate emacs buffer so I wrote this function:
(defun urls-check-if-working-link ()
(interactive)
(save-excursion
(let* ((a (copy-marker (point-min)))
(case-fold-search nil)
(enable-recursive-minibuffers t))
(goto-char a)
(while (search-forward-regexp "\\\\\\(?:href\\|url\\){\\([^}]+\\)}" nil t)
(save-excursion
(let ((URL (match-string 1)))
(unless (or
;; 1 - Commented String
(nth 4 (syntax-ppss))
;; 2 - It's a DOI
(string-match-p "doi\\.org" URL))
;; (eww-browse-url URL)
(shell-command (concat "lynx " URL))
;; taking time to do something:
(read-string (concat URL ": TEST"))))))
)))
Running it I get the error:
Your Terminal type is unknown!
I found I need to use ansi-term
to make lynx
work. The command:
(ansi-term "lynx" "*BUFFER-NAME*")
works, but I'm not able to make it open a given URL. I mean something like:
(ansi-term "lynx https://www.google.com" "*BUFFER-NAME*")
- Where I'm doing wrong?
- Do you suggest a different approach?