From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uKXOCkK1P2BTIQAA0tVLHw (envelope-from ) for ; Wed, 03 Mar 2021 16:11:46 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WPqcBkK1P2DTSAAA1q6Kng (envelope-from ) for ; Wed, 03 Mar 2021 16:11:46 +0000 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 8559C9826 for ; Wed, 3 Mar 2021 17:11:45 +0100 (CET) Received: from localhost ([::1]:49222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHU6C-0007tw-Co for larch@yhetil.org; Wed, 03 Mar 2021 11:11:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHU5l-0007s4-9p for emacs-orgmode@gnu.org; Wed, 03 Mar 2021 11:11:17 -0500 Received: from mout02.posteo.de ([185.67.36.66]:37611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHU5h-0004Mq-Vs for emacs-orgmode@gnu.org; Wed, 03 Mar 2021 11:11:16 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 478202400FC for ; Wed, 3 Mar 2021 17:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1614787871; bh=cAySaXu3ipohRbf+JGO5LRsZHA6q54aPqhjO2eLg4Xg=; h=From:To:Cc:Subject:Date:From; b=gRQNh0JXGXTKlKCseRZ04IfcJk1EgNsp+W+jYQ4bFRzh+kvNB66Ogzos02Jvf14F/ P3TsPQr8OqmReXARpNLhJIUUNGZp9sbkBBRX4pb1u1qvNPYK+ntiXwsg3q/9p3Uugo x7hoI2LvbWTl5HXs018kTlC0jPz8RgwODcXNdnp9wujMBN6YrCdaTUM/clL6FlfQy9 jSsoKO2/G1KX0JQwioU7RcR+TOYPLanS4rzmbdPcYlf6og7OLa1URabebHyWiEpjw+ Iinusub2yyvOjf3OrnDivof8fTMG2gPgAsL99r3LIwKlwdyA2Z89iXTUJtds+sZNdW 28js4xRA34yNg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4DrJrt0TqDz9rxj; Wed, 3 Mar 2021 17:11:09 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Maxim Nikulin Subject: Re: Org mode links: Open a PDF file at a given page and highlight a given string References: <87lfb5pbej.fsf@gmail.com> <87lfb5c6j0.fsf@posteo.net> Date: Wed, 03 Mar 2021 17:11:09 +0100 In-Reply-To: (Maxim Nikulin's message of "Wed, 3 Mar 2021 21:51:52 +0700") Message-ID: <87sg5cb4ki.fsf@posteo.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1614787905; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=iJPWTjHfs4EIAdbE2wrw005BN6VX36hNoVt11M+APxQ=; b=B0mPbxspXcuuAArhGBjf3CQ3Y59lFRegBm+BH4UKBBAIJwLtSCqfAIcFZ/rH/jGBkc230e L2OjVwGzzaR8+erao7t9UEHXZKiPL7Up/7uxnCVctKWpVgFff8hfV1F2CDCVrVu+SwwFWB Wc1BeACXKiWCUroCYCy6zJfRheaAM8jves5s3aqY67auk9sO+3VQhn/5N0+ex+GoEKdLRC CbXnShqm9ba05USn5JSHcezkj6ghdRQMVC/evqQJ3MVr6Yh4iwMbz+R9R2XROXgrlSe4pv 5heIHj1xrFSNf/soj8cAYtNngogxfhkmhCgmmXytad+5gapCTL0VVd9AzixsCw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1614787905; a=rsa-sha256; cv=none; b=ZEmRiJYIdOuY8wKQyqbY7iNqHCR5c2Ntt1ywLc4xKIHH8xS68mJVHS+fzI+eJwsBmU17Af CXgmL4IuCELdsgCPUKXszFVNgyIAhivv8oC926bebbyrfPGZODLqcELkgoaOhx1/fAhBLl FvG9tnBOB94/pe1azPxq2VSJzCnfmBUnbmSaFx+T0FFdF5Uev5n8axwBg9NMT+TK8Nqlzr YK2mrfvgtYDRqyz/d5rMRSN9nqhRmtudoWjyCJYPii/pAdP11H+KOaCPpWpTt/Q9oLzexp kxiFsPocq6Dk42UntW7s/ZBRP3vFJLWi0QrqAiTIL9/RBSBZiINUARUjUOLE/g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=gRQNh0JX; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=gRQNh0JX; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 8559C9826 X-Spam-Score: -3.06 X-Migadu-Scanner: scn1.migadu.com X-TUID: zN0MWdVVes9P Hi Maxim Thanks for your advice, which I appreciate very much. Maxim Nikulin writes: > On 03/03/2021 09:31, Juan Manuel Mac=C3=ADas wrote: >> (start-process-shell-command "zathura" nil (concat "zathura " >> clean-path >> " -P " >> pag >> (when str >> (format " -f '%s' " str))))))) > > Please, do not forget to pass stings coming from user input through > shell-quote-argument. There is combine-and-quote-strings function but=20 > its docstring tells that it is not safe enough. Ideally shell should > be completely avoided in such cases and arguments should be passed as > a list directly to exec. https://xkcd.com/327/ So, maybe it would look better like this (`start-process' instead of `start-process-shell-command')?: #+begin_src emacs-lisp (org-link-set-parameters "pdf-pag" :follow (lambda (path) (let ((pag (if (string-match "::\\([1-9]+\\):*:*\\(.*\\)" path) (format "--page=3D%s" (match-string 1 path)) (error "no pages"))) (clean-path (expand-file-name (replace-regexp-in-string "::.+" "" path))) (str (when (string-match "::\\([1-9]+\\)::\\(.+\\)" path) (format "--find=3D%s" (match-string 2 path))))) (if str (start-process "zathura" nil "/usr/bin/zathura" clean-path pag str) (start-process "zathura" nil "/usr/bin/zathura" clean-path pag))))) #+end_src Best reagards, Juan Manuel=20