From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id KM4yJ/vAEWSHBAAASxT56A (envelope-from ) for ; Wed, 15 Mar 2023 13:58:35 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cOIDJ/vAEWTyLgEAauVa8A (envelope-from ) for ; Wed, 15 Mar 2023 13:58:35 +0100 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 49830399AD for ; Wed, 15 Mar 2023 13:58:35 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcQhc-0007MW-HF; Wed, 15 Mar 2023 08:58:00 -0400 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 1pcI1X-0006oF-T1 for emacs-orgmode@gnu.org; Tue, 14 Mar 2023 23:41:59 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcI1W-0000h9-0p for emacs-orgmode@gnu.org; Tue, 14 Mar 2023 23:41:59 -0400 Received: by mail-pl1-x642.google.com with SMTP id h8so18681736plf.10 for ; Tue, 14 Mar 2023 20:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678851716; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=vKrRmsA3fYKm+YmVbKu4PdWZLrNC+FTm6w4SpKp6crw=; b=jEpb/YYZ8O52gVsDk26VA/JsJjqLtkbi4E0n+IJJFtYC956yl3shNDuLhmE2q3wIu/ JNH1lH7dotsVOKsl6K7KxCyyzWeZxOEYLKhn/Pa7r/VCSXrKN3XY6h+h2e7XsnlSc467 lvJ4e9twV50sB5pbZZrnQHi/odczOKVSJxyHuE+mhWofccy110UxuFqbkR0ehTkYeewx OZO3it9wJH6aZ70mW20llyARl2wZ0rj/ZmUjCk4nh/E7SWnTTmvPf4MjmJInon6jErT5 szo+7QNnEWxpjsBfJoVon1ojqin9dW8Z5uykxPmRBM0Yr7ZQfA00lZ0ES6amB3u4+4ph XdRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678851716; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vKrRmsA3fYKm+YmVbKu4PdWZLrNC+FTm6w4SpKp6crw=; b=siu0+QxICUvxM24LkB225n6fUhzMZFwYsVRUfnhZjZsN5vuA6JE7kLoZR3FbBU8lJL hfyOD0dOPbwFAs3Df8x/58BUX9TdsnXXtzJiUCusDu3MpJ4UfbIw2zRHwir49Jtc25ph QzmEY5n+a1vYjcZZEVAQu/7q9CDmhU9X+ne1K1q+m2zeAc+nomj1Ho7XAjxtaYvzYp6p uP/gDWgpYXz8HwB47TAUNm9DdYTFsZuUDxrhKQMZwsWdIzeG+ZA4OtxFP2jUI/Zar10s kFx+7aMBxUEjNG5XjcozBTUs6KvQPjTlcAjlW64sOI6D75CoG/XfA4iT6+EZDvbWoEjY KBoA== X-Gm-Message-State: AO0yUKVKwhHHpnrBIJEgRfLQqhriRuDt7s3ZXjoYiKxv37XD92ahBTSD A30wqa1OtwpVhHoVC89z1HWamtxVTaVZvZP9L6c= X-Google-Smtp-Source: AK7set9XouNKxKEI5zLyEsxt2eDJkJl1OBcg67DAioVmbTwHg6O1Z29XD3/ZFyzprTBjCDACdw9GoA== X-Received: by 2002:a05:6a20:a11c:b0:cc:63c6:8d3a with SMTP id q28-20020a056a20a11c00b000cc63c68d3amr42252601pzk.41.1678851715614; Tue, 14 Mar 2023 20:41:55 -0700 (PDT) Received: from smtpclient.apple (n058153171249.netvigator.com. [58.153.171.249]) by smtp.gmail.com with ESMTPSA id y3-20020aa78543000000b006250bf43756sm2347000pfn.2.2023.03.14.20.41.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2023 20:41:55 -0700 (PDT) From: Kai Ma Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Find-file using org-protocol Message-Id: Date: Wed, 15 Mar 2023 11:41:41 +0800 To: emacs-orgmode@gnu.org X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::642; envelope-from=justksqsf@gmail.com; helo=mail-pl1-x642.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 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, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 15 Mar 2023 08:57:54 -0400 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-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="jEpb/YYZ"; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678885115; a=rsa-sha256; cv=none; b=fHKZkxmqZVAMP6AxT76IFImzZFVVGZKjSNJP26cwaFVTvMdT8OfUmiXv7yedk7owptBfGf 9kZihZ+5ePWpLF/g+zRmXPUXjgfK2TkxBiNICb+5kSSEgFrTCvhZXF/H12PJLO9GIBOWIX CIWFHqodFXUmH2zxtCi7/3rDIolyVmWvAqInBL+tYVDBMt4BHMlFAEup8rA8QIwbsWEh08 bYbg1wX5CGNMeY3/j0QahqvHO2h0kP4GW4anO7q+K0Gmv8et4hBEyyslDoXUA1IqER/9+D IAsPsE1ZOPJZoBevh6q3Y09XnOMIvpI7lclpesBzZjUUaEgHHnHgT33vVqOgcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678885115; 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=vKrRmsA3fYKm+YmVbKu4PdWZLrNC+FTm6w4SpKp6crw=; b=Q9toJ6hzdZMZmk5K86ZFLH/hnePtzjs5Rvh6RpKvMuusvsoqivhmz0xdAewrP5k3xPEOFr 6Mo74R2jCwIG2viXZv4LThPgfregcRTkBpYi36m6g33LHQvQo1jWsgtRo+3MVu/au3MYFo KyqKD263J1XLd1XFs7ClomXa/D7teGilsUmaMr5RFs3OWHn2czO7bF2fdpzSyu4WWvgeNu fSPrqKg7u+5tSjHnOaY6/yJi3gRRBx2QkuDC/IDKGiiKRbITn7rgMyfYofeDoMQOn6BC1g 2cnheskjgPMLftDSyUR8ARMs6mlqksNz2dP5AnF2ZsJLzFiuoi/B438s+TJgoA== X-Migadu-Spam-Score: -4.47 X-Spam-Score: -4.47 X-Migadu-Queue-Id: 49830399AD X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="jEpb/YYZ"; 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"; dmarc=pass (policy=none) header.from=gmail.com X-TUID: KouB9g4dDNnV Hi org I=E2=80=99m using org-protocol to open local files in an Emacs client. = Yes, this is weird, but it is required for some Electron apps, because = they do not allow calling arbitrary commands. This is how I do it: (use-package org-protocol :config (add-to-list 'org-protocol-protocol-alist '("org-find-file" :protocol "find-file" :function = org-protocol-find-file :kill-client nil)) (defun org-protocol-find-file (fname) "Process org-protocol://find-file?path=3D style URL." (let ((f (plist-get (org-protocol-parse-parameters fname nil = '(:path)) :path))) (find-file f) (raise-frame) (select-frame-set-input-focus (selected-frame))))) It works, but there=E2=80=99s a minor annoyance: the buffer it opens is = not associated with the client. And killing the client won=E2=80=99t = kill the buffer it creates. Upon some inspection, I find that = org-protocol-check-filename-for-protocol seems to discard information = about the client, so I cannot set server-buffer-clients and = server-existing-buffer accordingly myself. I=E2=80=99m writing to ask if there is a better way than advising = server-visit-files or org-protocol-check-filename-for-protocol? Thanks! Regards, Kai=