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.
This commit is contained in:
parent
3486bfd3ef
commit
c4328c9c08
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue