I configured org-capture with below elisp in init.el:
(define-key global-map "\C-cc" 'org-capture)
(setq my-org-capture-file (concat org-directory "/capture.org"))
(setq my/line "%(with-current-buffer (org-capture-get :original-file-nondirectory) (thing-at-point 'line t))")
(setq org-capture-templates
`(
("n" "Review Notes"
entry (file+headline ,my-org-capture-file "Code Review")
,(format "* TODO %%?\n %%l\n %s" my/line))
))
Then when I review code to take notes with 'n', I got below results:
** TODO
[[file:/tmp/linux-4.14-rc8/drivers/video/fbdev/geode/video_cs5530.c::static%20int%20cs5530_blank_display(struct%20fb_info%20*info,%20int%20blank_mode)]]
static int cs5530_blank_display(struct fb_info *info, int blank_mode)
It works perfect but the link description is too long. I wish to display the file name without path and line info, e.g. video_cs5530.c for this case.
I try to use %a to replace %l, results is the same.