From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.devel Subject: Re: hyperscope Date: Fri, 6 Nov 2020 22:18:52 +0300 Message-ID: References: <234bba7f-fd5c-ed39-8a5e-8a6ce3125bf1@inventati.org> <87blgbwjsl.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23639"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/+ (1036f0e) (2020-10-18) Cc: Adam Porter , Emacs developers To: Eduardo Ochs Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 06 20:21:37 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kb7In-0005wk-6r for ged-emacs-devel@m.gmane-mx.org; Fri, 06 Nov 2020 20:21:37 +0100 Original-Received: from localhost ([::1]:44864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kb7Im-0007Vs-AU for ged-emacs-devel@m.gmane-mx.org; Fri, 06 Nov 2020 14:21:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kb7Gi-0005oc-RL for emacs-devel@gnu.org; Fri, 06 Nov 2020 14:19:29 -0500 Original-Received: from static.rcdrun.com ([95.85.24.50]:46941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kb7Gh-0003P0-3Y for emacs-devel@gnu.org; Fri, 06 Nov 2020 14:19:28 -0500 Original-Received: from localhost ([::ffff:197.157.0.43]) (AUTH: PLAIN admin, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by static.rcdrun.com with ESMTPSA id 00000000002C0006.000000005FA5A1BD.00002942; Fri, 06 Nov 2020 19:19:22 +0000 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=95.85.24.50; envelope-from=bugs@gnu.support; helo=static.rcdrun.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/06 13:51:50 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:258849 Archived-At: * Eduardo Ochs [2020-11-06 21:19]: > do you have examples of the syntax of these links and of what we need > to make them work? I am especially interested in "MPV play video at > exact time", "Launch Program", "Media", "PDF by Page Nr." and > "Set"... I do not have universal approach similar like URL, it is database approach such as (hyperscope 123) where ID 123 is defined to open specific video at specific time. Links are shown to user on screen as such and users define them but they are not accessible without database. > I am asking because one of the topics of my talk at the next EmacsConf > (in a few weeks!) is how eev implements links to all these things, > and I want to compare eev's approach with other packages. See: > > http://angg.twu.net/eev-intros/find-pdf-like-intro.html > http://angg.twu.net/eev-intros/find-audiovideo-intro.html I was researching eev before weeks and it has alignment with some principles of collective IQ creation, so I may as well include eev mode in my hyperscope if such exist. Here are some functions handling those links, you may see that mpv opens up by using id (defun hlink-mpv-play-video-at-exact-time (id) (let* ((link (hlinks-link id)) (arguments (hlinks-arguments id)) (command (format "mpv --start=%s '%s'" arguments link))) (async-shell-command command) (hlink-description-show id))) (defun hlink-show-pdf-by-page (link argument) "Opens the PDF page by number" (funcall (intern hyperscope-pdf-function) link argument)) hyperscope-pdf-function: (defun hyperscope-evince (file &optional page query) "Opens PDF with evince document viewer" (let* ((command "evince") (command (if page (format "%s --page-index=%s" command page) command)) (command (if query (format "%s -l '%s'" command query) command)) (command (format "%s '%s'" command file))) (async-shell-command command))) > I know org-player and org-pdftools, but I found them hard to set up. It is better you make simple eev based functions to handle such links. Maybe this function below can open PDF inside of Emacs at specific page number for maybe specific query in PDF/DJVU/DVI or specific match. But it could be as well not functional. I have to test it to confirm, but you could reuse for evv to view PDF/DJVU/DVI finely grained inside of Emacs. (defun doc-view-open-file (file &optional page-number query match) "Opens PDF file in GNU Emacs at specific page number or at specific match" (let* ((allowed-extensions '("pdf" "djvu" "dvi")) (file-ext (file-name-extension file)) (match (if match match 0))) (when (and (file-exists-p file) (seq-contains-p allowed-extensions file-ext 'equalp)) (setq doc-view--current-search-matches nil) (let ((created (create-file-buffer file)) (buffer (get-file-buffer file))) (switch-to-buffer created) (set-visited-file-name file t) (insert file) (doc-view-mode) (read-only-mode) (when page-number (doc-view-goto-page page-number)) (when query (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))) (if (file-readable-p txt) (progn (setq doc-view--current-search-matches (doc-view-search-internal query txt)) (doc-view-search-next-match match)))))))))