From 2e269860c48696ca6fd0a76315a85ca3fd1ee3bc Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sun, 28 Sep 2014 00:59:08 +0400 Subject: emacs: Support font-locking. Avoid breaking highlighting after adding new font-lock keywords. * emacs/guix-base.el (guix-insert-package-strings): Use 'propertize' instead of 'guix-get-string'. * emacs/guix-info.el (guix, guix-action, guix-file, guix-url, guix-package-location, guix-package-name): New button types. (guix-info-insert-action-button, guix-info-insert-file-path, guix-info-insert-url, guix-package-info-insert-location, guix-package-info-insert-full-names, guix-package-info-insert-non-unique-text): Adjust for 'guix-insert-button' and button types. (guix-package-info-name-button): New face. (guix-package-info-define-insert-inputs): Use it. Add new button types. (guix-package-info-insert-full-name): Remove. * emacs/guix-utils.el (guix-get-string): Replace 'face' with 'font-lock-face'. (guix-insert-button): Adjust for using button types. --- emacs/guix-utils.el | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'emacs/guix-utils.el') diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el index c1fe1a3a38..f99c2ba884 100644 --- a/emacs/guix-utils.el +++ b/emacs/guix-utils.el @@ -23,7 +23,7 @@ ;;; Code: -;; (require 'cl-lib) +(require 'cl-lib) (defvar guix-true-string "Yes") (defvar guix-false-string "–") @@ -52,7 +52,7 @@ If FACE is non-nil, propertize returned string with this FACE." val guix-list-separator)) (t (prin1-to-string val))))) (if (and val face) - (propertize str 'face face) + (propertize str 'font-lock-face face) str))) (defun guix-get-time-string (seconds) @@ -84,22 +84,13 @@ at point between each FUNCTION call." (funcall function obj)) (cdr sequence)))) -(defun guix-insert-button (label face action &optional message - &rest properties) - "Make button with LABEL and insert it at point. -Propertize button with FACE. -ACTION is a function called when the button is pressed. It -should accept button as the argument. -MESSAGE is a button message. +(defun guix-insert-button (label &optional type &rest properties) + "Make button of TYPE with LABEL and insert it at point. See `insert-text-button' for the meaning of PROPERTIES." (if (null label) (guix-format-insert nil) - (apply #'insert-text-button - label - 'face face - 'action action - 'follow-link t - 'help-echo message + (apply #'insert-text-button label + :type (or type 'button) properties))) (defun guix-split-insert (val &optional face col separator) -- cgit v1.2.3