From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id ACBOAFRSxWVTXgEA62LTzQ:P1 (envelope-from ) for ; Thu, 08 Feb 2024 23:14:44 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id ACBOAFRSxWVTXgEA62LTzQ (envelope-from ) for ; Thu, 08 Feb 2024 23:14:44 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=GsvftCmb; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707430483; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=x1X1vAczQGfKJfvsZDRDCQiGtTvkY11bsNue8dRjIyc=; b=RIimw2d5wSwyx8kolcbIyV9qJs3aROVy+dYHtszmcjGHN0Jun5Ws/qyqms4+y3xZ4DDG2K e1+WIt8qLCW5+1uQ9xAHaSYMd1LC7ZWfgGGkjmeAXrS7IPunMt3T2S6w1VSGrTn4fbwztY gVMRSI89q8PTbntIAxfvPoTaTvyaKSU3S+sTbVX0aQzTIL+1t59clkMnjISwZBa6As+NjK T2HQDXW+VTbz8heMG8fmOz0dsD0dFH0da2uDmTRPzyqr5HRdetI3+ejQnO0nSJfb87zoJ5 iiZjUse3Xll0/1RpeK05+6Wjg0xclV/QZA5AFXUHhgPRrnCpIQdg+T+TAWAtIw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=GsvftCmb; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707430483; a=rsa-sha256; cv=none; b=bzCkDEGFjdlHAxm6V/GpaG1ANIheHf0nD+EZNG0D2lczIGUypmLZ0XMjSY9eYae43/emLy OaZKG8k3l6OElKNNmvzpjuHBL/Bmg9hec2nASOFExixwcGjpcfGici8SToLdhMus1u1GFN D7MQWD4gMqaBegm/Dy5dp6+IYJrWNS5ph03x6vAvY4tl/OkTwsqmP8uDlSpFEgTMI0lDQH nZXw/oPSWiFQJkrAuyJ9NZj74GRQMX0/xtjmyyZuK17Fok09OBGKrhZ95i2oFWO4eOFKIj 6goLi830ULBQRkxhIjma6BfGFPQomSZvwrxq2uw6MCplfNNYcFkf1VZzY6rVqA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CC5B82139C for ; Thu, 8 Feb 2024 23:14:43 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYCej-0006wd-RK; Thu, 08 Feb 2024 17:14:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYCeh-0006wG-RQ for emacs-orgmode@gnu.org; Thu, 08 Feb 2024 17:14:03 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYCea-0006W1-5U for emacs-orgmode@gnu.org; Thu, 08 Feb 2024 17:14:03 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 98668240027 for ; Thu, 8 Feb 2024 23:13:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707430433; bh=VmOJnZp2mB4ZvXl/1LotW4eaEoghKRTdWPRykPCUHDI=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=GsvftCmbr8sGavPkJyg0QQVggehJT+6hSy8bRL9QpI/BfNdZPWnMo59HFY6Zpwl13 JtSf9raAGeuRn8JQJ+YRLhtLP+Qv3lCRJGbd0Bj1pz8PW59x41GPYm4JblgozMEsK3 fCvfAsm7zRrcAFCjyRvfQ5EE+XZzN1/qdtyQmodVSFucUm6p0AMPMKEy+4dSPFxlst VL+vysPJmJhYyapxfvQ23unu+SVHDimXLpKVMDbB7pJIw4WgLSMcB3aMzVRlYzmE+N NJTx3Tey0r4AXv5qMHdOVP3VgaTRqo9ui73XuOXbg31BMM+jq0yiAvmG6lCqWEWLUU aQG6Pm+NSZLbg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TWB8d1g28z6tw8 for ; Thu, 8 Feb 2024 23:13:53 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Link type for pdf-tools annotations Date: Thu, 08 Feb 2024 22:13:50 +0000 Message-ID: <87h6iitxi9.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -8.73 X-Spam-Score: -8.73 X-Migadu-Queue-Id: CC5B82139C X-Migadu-Scanner: mx12.migadu.com X-TUID: udd95hAjfXnu Hi, Many times I need to "save" an annotation point in the pdf-tools annotations buffer. So I defined a new link type and the function to store it. The link is stored with the structure: [[pdf-annot:/path/to/file.pdf::annotation-date][file-name.pdf (annot. on p.= page-number)]] The link opens the PDF and jumps to the specific annotation. A screenshot: https://i.imgur.com/hw96NfD.png I share the code here in case it is useful to someone: #+begin_src emacs-lisp (defun my-org-pdf-annot-store-link () (when (equal (format "%s" major-mode) "pdf-annot-list-mode") (let* ((pdf-buf pdf-annot-list-document-buffer) (pdf-file (buffer-file-name pdf-buf)) (annot (pdf-annot-getannot (tabulated-list-get-id) pdf-buf)) (date (pdf-annot-print-property annot 'modified)) (page (save-excursion (beginning-of-line) (re-search-forward "\\(^\s+\\)\\([[:digit:]]+\\)" nil t) (match-string 2))) (link (concat "pdf-annot:" pdf-file "::" date)) (desc (format "%s (annot. on p. %s)" (file-name-nondirectory pdf-file= ) page))) (org-link-store-props :type "pdf-annot" :link link :description desc)))) (org-link-set-parameters "pdf-annot" :follow (lambda (path) (let ((a (if (string-match "::\\(.+\\)" path) (match-string 1 path) (error "no annotation date"))) (file-path (replace-regexp-in-string "::.+" "" path))) (find-file file-path) (pdf-annot-list-annotations) (let ((anot-buf (format "*%s's annots*" (file-name-sans-extension (buffer-name))))) (with-current-buffer anot-buf (save-excursion (goto-char (point-min)) (re-search-forward a nil t) (call-interactively #'pdf-annot-list-display-annotation-from-id)))))) :store #'my-org-pdf-annot-store-link) #+end_src Best regards, Juan Manuel=20 --=20 Juan Manuel Mac=C3=ADas -- Composici=C3=B3n tipogr=C3=A1fica, tratamiento d= e datos, dise=C3=B1o editorial y ortotipograf=C3=ADa