给杀手配把刀:emacs org-mode下做笔记时截屏

    技术2026-10-05  0

    给杀手配把刀:emacs org-mode下做笔记时截屏

     

     

     

    org-mode是emacs中的杀手级应用。

     

     

     

    杀手级应用的意思是 非常牛,你喜欢一个东西的本质的原因。

     

     

     

    比如,

     

    游戏是微软Windows操作系统的杀手级应用,没有了游戏,很多人会放弃Windows;

     

    网络相关是Linux的杀手级应用,没有网络,很多个宁可用DOS吧;

     

    美貌是小姑娘们的杀手级应用;

     

     

     

    而小伙们的杀手级应用,据说日本是自立自强,美国是自立自强,欧洲是自立自

     

    强,我们国家是。。。

     

     

     

    不少人因为org-mode而从vim投奔了emacs,

     

    很多个因为org-mode知道了emacs。

     

     

     

    顺便说一些,org-mode管理GTD也非常方便。如果你知道GTD是什么,那你就知道

     

    org-mode牛了,

     

     

     

    如果你不知道GTD,值得GOOGLE一下。很多年以后,你会忘记是从我这里听到这个

     

    词,但是,这个词本身会被你牢记。

     

     

     

    以前因为主要以mybase做笔记,偶尔用 emacs org-mode,偶尔用wiki,插入图片

     

    的问题一直没有我引起重视。

     

     

     

    手动插入图片的时候,还是不够方便。方法见下面。

     

     

     

    今天抄并改了个函数,专门用于

     

      截屏然后保存并插入在当前org文件中。

     

     

     

    这样,我的Ubuntu生存,完全过渡结束了。

     

     

     

    * 手动

     

     

     

    ** 插入图片

     

     

     

    : #+CAPTION: title for the image

     

    : [[./images/screenshot_20111202-101201.png]]

     

     

     

    ** 切换显示图片或图片文件名

     

     

     

    : C-c C-x C-v

     

    : M-x org-toggle-inline-images

     

     

     

    * 截屏的代码

     

     

     

    按win-s键,然后用鼠标划要截屏的范围。

     

    这一部分会保存在当前org文件的目录下的images目录下,文件名随机。

     

    如果该目录不存在,会自动建立。

     

     

     

    : ;; screenshot in org-mode

     

    : ;; modified by gift.young@gmail.com

     

    : ;; based on [http://praktikanten.brueckenschlaeger.org/2010/11/28/screenshots-in-org-mode]

     

    : (defun my-screenshot ()

     

    : "Take a screenshot into a unique-named file in the current buffer file 

     

    : directory and insert a link to this file."

     

    : (interactive)

     

    : (setq filename

     

    :   (concat (make-temp-name  

     

    :   (concat (file-name-directory (buffer-file-name)) "images/" ) ) ".png"))

     

    : (if (file-accessible-directory-p (concat (file-name-directory (buffer-file-name)) "images/"))

     

    :   nil 

     

    :   (make-directory "images"))

     

    :  (call-process-shell-command "scrot" nil nil nil nil "-s" (concat "/"" filename "/"" ))

     

    :  (insert (concat "[["  filename "]]"))

     

    :  (org-display-inline-images)

     

    : )

     

    : 

     

    : (global-set-key (kbd "s-s") 'my-screenshot)

     

     

     

    * 依赖

     

     

     

    scrot             0.8-11            command line screen capture utility

     

    最新回复(0)