From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: [org-contacts] How to show avatar image on org headings? Date: Wed, 09 May 2018 21:31:02 +0800 Message-ID: <87wowdx8fd.fsf@gmail.com> References: <87fu342pj7.fsf@gmail.com> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGPBc-0007tZ-FI for emacs-orgmode@gnu.org; Wed, 09 May 2018 09:31:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGPBW-0001BR-Jp for emacs-orgmode@gnu.org; Wed, 09 May 2018 09:31:16 -0400 Received: from [183.249.134.109] (port=14008 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGPBW-00012P-4Z for emacs-orgmode@gnu.org; Wed, 09 May 2018 09:31:10 -0400 In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: org-mode Hi, Kitchin, thanks for your sharing. Following your code example, I did small modification to use on my case. Here is my code: #+begin_src emacs-lisp (defvar image-overlay-re (concat ":ICON:" "\\(?3:'\\|\"\\)\\(?1:.*\\." (regexp-opt '("png" "PNG" "jpg" "jpeg" "JPG" "JPEG" "gif" "GIF" "eps" "EPS")) "\\)\\(?:\\3\\)") "Regexp to match image filenames in quotes") (defun org-contacts-icon-property-image-overlay (&optional limit) (when (re-search-forward image-overlay-re limit t) (let ((beg (match-beginning 0)) (end (match-end 0)) (image-file (match-string 1))) (when (file-exists-p image-file) (setq org-contacts-icon-property-iimage (create-image (expand-file-name image-file) 'imagemagick nil :width 300)) (setq org-contacts-icon-property-image-overlay (make-overlay beg end)) (overlay-put org-contacts-icon-property-image-overlay 'display image) (overlay-put org-contacts-icon-property-image-overlay 'face 'default) (overlay-put org-contacts-icon-property-image-overlay 'org-image-overlay t) (overlay-put org-contacts-icon-property-image-overlay 'modification-hooks (list 'org-display-inline-remove-overlay)))))) (font-lock-add-keywords nil '((org-contacts-icon-property-image-overlay (0 'font-lock-keyword-face t))) t) #+end_src But when I evaluate upper code, and re-enable org-mode on Contacts.org file. The :ICON: property value "John.png" is not displayed as image. Is there something wrong? I choose to use overlay to auto display image when open org-contacts file. -- [ stardiviner ] don't need to convince with trends. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3