From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aMoNAbJd/l79VgAA0tVLHw (envelope-from ) for ; Thu, 02 Jul 2020 22:20:34 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MLiEOLFd/l4nQQAAB5/wlQ (envelope-from ) for ; Thu, 02 Jul 2020 22:20:33 +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 4B0AC94051E for ; Thu, 2 Jul 2020 22:20:33 +0000 (UTC) Received: from localhost ([::1]:35468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jr7ZG-0003e5-Ph for larch@yhetil.org; Thu, 02 Jul 2020 18:20:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jr7Yr-0003dd-33 for emacs-orgmode@gnu.org; Thu, 02 Jul 2020 18:20:05 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:57340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jr7Yo-0000A5-JK for emacs-orgmode@gnu.org; Thu, 02 Jul 2020 18:20:04 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 487C7D2ACE; Thu, 2 Jul 2020 18:19:59 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=hN0jDxigK4Zqhub7xmTjwAnaZzU=; b=M1b2F9 9BnpU1TVr7gp4gUWWii2C4W3567Dife9GIv1eSG13fA+VrwTYgDK+VUmGDdGmiWi WYW7kqzPg3NKtSAxgMubn5se9tJkJk6f9WASRUCuMOqg5ARHcAdzAad/9ofwdLEk MBWNynurnpdyWRYcOpSB9Y3/BpX/P808ONI0A= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 40AE7D2ACD; Thu, 2 Jul 2020 18:19:59 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=zTWk0jAvymFDO02qVvqS2kkHY+5hzCMKWJqnR4cg1UY=; b=EKQ6EyMl2n/9DD4INISXdjvVMbfnqqEG3TOFE+0/nq1BpUPUaSN55unuQM/HtqXh9xKEvtbzRJXeT7+ie8ywT8WfHIBv+NXezhyQi4lEtJl6dwzZGD7roP2silL2vlVNWy5aeOGq/Ocwru6PAY0bR3owFxInsETFNTR2DKsPmx8= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 95E56D2ACA; Thu, 2 Jul 2020 18:19:55 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Daniele Nicolodi Subject: Re: Link to source file location with content preview In-Reply-To: <8d7d36e4-86c0-06d0-d7e0-e33ff509f7e7@grinta.net> References: <8d7d36e4-86c0-06d0-d7e0-e33ff509f7e7@grinta.net> Date: Thu, 02 Jul 2020 18:19:53 -0400 Message-ID: <87o8oxv9ti.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 2900BDA4-BCB2-11EA-93AE-8D86F504CC47-24757444!pb-smtp21.pobox.com Received-SPF: pass client-ip=173.228.157.53; envelope-from=kyle@kyleam.com; helo=pb-smtp21.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/02 18:19:59 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=M1b2F9 9; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=EKQ6EyMl; dmarc=none; 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-Spam-Score: 0.29 X-TUID: HthIvAwSltxh Daniele Nicolodi writes: > A related question: does anyone have some elisp code that turns a Grep > buffer (the results of running "M-x grep") into org-mode links to the > locations? I have something like that. I haven't used it in a while, but a quick tests suggests it still works. If you keep it around/modify it, you'll want to update the obsolete org-make-link-string to org-link-make-string. -- >8 -- (defun km/org-grep-buffer-to-list () "Convert `grep-mode' buffer to Org mode list." (interactive) (let ((result-re (rx line-start (group (one-or-more (not (any ":")))) ":" (group (one-or-more digit)) ":" (group (one-or-more not-newline)) line-end)) (dir default-directory) results cmd) (save-excursion (goto-char (point-min)) (forward-line 3) (setq cmd (buffer-substring-no-properties (line-beginning-position) (line-end-position))) (forward-line 1) (while (and (not (looking-at-p "\n\\s-*$")) (re-search-forward result-re nil t)) (push (list (match-string-no-properties 1) (match-string-no-properties 2) (match-string-no-properties 3)) results)) (with-current-buffer (get-buffer-create "*Org grep results*") (setq default-directory dir) (erase-buffer) (insert "\n* Results [/]\n\n") (insert (format "Call: %s\n\n" cmd)) (pcase-dolist (`(,file ,_ ,text) (nreverse results)) (insert (format "- [ ] %s\n" (org-make-link-string (concat "file:" file "::" text) (let ((desc (concat file ":" text))) (if (> (length desc) 72) (substring desc 0 72) desc)))))) (org-mode) (org-back-to-heading) (org-update-checkbox-count) (org-show-entry) (pop-to-buffer (current-buffer))))))