diff options
author | Tom Willemse | 2020-04-20 15:08:18 -0700 |
---|---|---|
committer | Tom Willemse | 2020-04-20 15:08:18 -0700 |
commit | c4328c9c082af9a9bf49d35fcec3e1f62bc46870 (patch) | |
tree | d658541507637c9c9560362da1d79a0bed5417ce | |
parent | 3486bfd3ef77a856bbd9f1fbb67e2936889e5b67 (diff) | |
download | emacs-config-c4328c9c082af9a9bf49d35fcec3e1f62bc46870.tar.gz emacs-config-c4328c9c082af9a9bf49d35fcec3e1f62bc46870.zip |
Fix code example capture for non-unique buffers
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.
-rw-r--r-- | oni-org/oni-org.el | 6 |
1 files 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 <tom@ryuslash.org> ;; 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) |