From c4328c9c082af9a9bf49d35fcec3e1f62bc46870 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 20 Apr 2020 15:08:18 -0700 Subject: [PATCH] Fix code example capture for non-unique buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there are 2 files name "Program.cs" open, for example, the simple ‘(get-buffer "Program.cs")’ won’t work. ‘find-file-noselect’ can work if we pass in the full file path using the ‘%F’ format placeholder. --- oni-org/oni-org.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index b0c3fb4..5cd4cd2 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.0413.003316 +;; Version: 2020.0420.150732 ;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org-plus-contrib org-bullets org-edna diminish all-the-icons) ;; This program is free software; you can redistribute it and/or modify @@ -256,11 +256,11 @@ _l_: Store link ^^ _j_: Journal entry ("cc" "Marked code example with notes" plain (clock) " %U - - File: [[file:%F::%(number-to-string (with-current-buffer (get-buffer \"%f\") (line-number-at-pos (region-beginning))))][%f]] + - File: [[file:%F::%(number-to-string (with-current-buffer (get-buffer (find-file-noselect \"%F\")) (line-number-at-pos (region-beginning))))][%f]] %? - #+BEGIN_SRC %(string-remove-suffix \"-mode\" (symbol-name (with-current-buffer (get-buffer \"%f\") major-mode))) + #+BEGIN_SRC %(string-remove-suffix \"-mode\" (symbol-name (with-current-buffer (get-buffer (find-file-noselect \"%F\")) major-mode))) %i #+END_SRC" :empty-lines 1)