有无方法通过icon区分org-mode中链接类型?

因为这不是一个优先级较高的需求,在探索过程不断遇到很多新的概念,近期不会投入大量时间在此。先记录一下我的思路,一方面希望大家得到解决方法或解决问题元方法的帮助,另一方面如果给新人带来如何解决emacs问题的思路就更好了。

目标:在链接的文字旁边附加图标,而不是完全取代链接

解决思路

  1. 直接搜索 org link with image/icon 没有结果
  2. 思考有没有类似修改方案,或许是 defface ? 查看defface 发现其属性主要是调整常规的大小、字体、颜色等
  3. 个人无法解决。论坛提问
  4. 在坛友指导下,搜索到 39.16 The display Property,快速浏览该节大纲
    • Replacing Specs: Display specs that replace the text. 排除。不是替代

    • Specified Space: Displaying one space with a specified width. 排除,不相关

    • Pixel Specification: Specifying space width or height in pixels. 排除,不相关

    • Other Display Specs: Displaying an image; adjusting the height, spacing, and other properties of text. 有可能有用

    • Display Margins: Displaying text or images to the side of the main text. 有可能有用

  5. 进一步浏览后两节,排查可能的选项
    1. 可能选项 the specified bitmap be displayed in the left or right fringes for that line
      (left-fringe  bitmap [face] )
      (right-fringe  bitmap [face] )
      
      在github搜索 left-fringe 找到 nschum/fringe-helper.el: Emacs: helper functions for fringe bitmaps,进一步找到使用场景: 图片 结论:fringe是行首或行尾的 边缘 ,不适合在文本链接旁边加图标的场景
    2. 可能选项 image descriptor, When used as a display specification, it means to display the image instead of the text that has the display specification. (image . image-props) 是替代文本?需要进一步考察
    3. 可能选项 A margin display specification looks like ((margin right-margin) spec ) or ((margin left-margin) spec ) . Here, spec is another display specification that says what to display in the margin. Typically it is a string of text to display, or an image descriptor.
  6. 理解应用场景,可能类似的实例找到 [想法]Org agenda 显示时间块 - #2,来自 stardiviner
    • 确定使用 propertize 方法

作为新手,困难主要在于:

  1. 不能清晰地定义问题,不知道该用什么关键词去搜索
  2. 因为使用场景少,不能联想到类似案例
  3. 很多时候一个问题带来更多的问题,不理解的术语源源不断

已经由热心的 stardiviner 解决,感谢!

1 个赞