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>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; 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)
|
;; 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
|
;; 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
|
("cc" "Marked code example with notes" plain
|
||||||
(clock)
|
(clock)
|
||||||
" %U
|
" %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
|
%i
|
||||||
#+END_SRC"
|
#+END_SRC"
|
||||||
:empty-lines 1)
|
:empty-lines 1)
|
||||||
|
|
Loading…
Reference in a new issue