[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replacing a function with another one
From: |
lee |
Subject: |
Re: replacing a function with another one |
Date: |
Sat, 15 Mar 2014 21:22:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Jambunathan K <kjambunathan@gmail.com> writes:
> Hello OP,
>
> It seems you don't mind digging in to elisp code.
Well, I have to; It`s a great source to learn from :)
> ----------------------------------------------------------------
>
> (add-hook 'find-file-hook 'hi-lock-find-file-hook)
> (add-hook 'after-save-hook 'hi-lock-file-save-patterns)
>
> (defun hi-lock-find-file-hook ()
> (when (and (boundp 'hi-lock-patterns-file)
> (file-readable-p hi-lock-patterns-file))
> (let ((patterns (with-current-buffer (find-file-noselect
> hi-lock-patterns-file)
> (goto-char (point-min))
> (prog1 (ignore-errors (read (current-buffer)))
> (kill-buffer)))))
> (setq hi-lock-interactive-patterns patterns)
> (font-lock-add-keywords nil hi-lock-interactive-patterns t))))
>
> (defun hi-lock-file-save-patterns ()
> (interactive)
> (when (boundp 'hi-lock-patterns-file)
> (let ((patterns (append hi-lock-file-patterns
> hi-lock-interactive-patterns)))
> (with-current-buffer (find-file-noselect hi-lock-patterns-file)
> (erase-buffer)
> (insert (pp-to-string patterns))
> (save-buffer 0)))))
>
> ----------------------------------------------------------------
I see what it does, thank you :) I think I can use some of this when I
make an addition to hi-lock.el.
--
Knowledge is volatile and fluid. Software is power.
- Re: replacing a function with another one, (continued)
- Re: replacing a function with another one, Stefan Monnier, 2014/03/12
- Re: replacing a function with another one, lee, 2014/03/12
- Re: replacing a function with another one, Jambunathan K, 2014/03/12
- How to propose an emacs patch (Re: replacing a function with another one), lee, 2014/03/15
- Re: How to propose an emacs patch (Re: replacing a function with another one), Jambunathan K, 2014/03/15
- Re: How to propose an emacs patch (Re: replacing a function with another one), lee, 2014/03/17
- Re: replacing a function with another one, lee, 2014/03/10
- Re: replacing a function with another one, Michael Heerdegen, 2014/03/10
Re: replacing a function with another one, Jambunathan K, 2014/03/12