[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 150/352: Lisätään matalan tason funktiot face-tietojen käsittely
From: |
Stefan Monnier |
Subject: |
[elpa] 150/352: Lisätään matalan tason funktiot face-tietojen käsittelyyn |
Date: |
Mon, 07 Jul 2014 14:03:25 +0000 |
monnier pushed a commit to branch master
in repository elpa.
commit e7c635cae2dae9c36285c2841c7d251da9ef9471
Author: Teemu Likonen <address@hidden>
Date: Mon Feb 22 17:17:47 2010 +0000
Lisätään matalan tason funktiot face-tietojen käsittelyyn
Näiden funktioiden tarkoitus on toimia varsinaisen työn tekijänä uudelle
ominaisuudelle, joka mahdollistaa ainoastaan tiettyjen alueiden
lukemisen puskurista. Kyseinen uusi ominaisuus lisätään käyttöön
myöhemmin.
---
wcheck-mode.el | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/wcheck-mode.el b/wcheck-mode.el
index f5ca399..80b33fb 100644
--- a/wcheck-mode.el
+++ b/wcheck-mode.el
@@ -871,6 +871,65 @@ visible in BUFFER within position range from BEG to END."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Face information functions
+
+
+(defun wcheck-collect-faces (beg end)
+ "Return a list of faces between positions BEG and END."
+ (let ((pos beg)
+ face faces)
+ (while (< pos end)
+ (setq face (get-text-property pos 'face)
+ faces (append (if (and face (listp face))
+ face
+ (list face))
+ faces)
+ pos (1+ pos)))
+ (delete-dups faces)))
+
+
+(defun wcheck-major-mode-op-mode (mode)
+ "Return the associated operation mode for major mode MODE.
+See the variable `wcheck-read-or-skip-faces' for more
+information."
+ (cadr (assq mode wcheck-read-or-skip-faces)))
+
+
+(defun wcheck-major-mode-faces (mode)
+ "Return the face list configuration for major mode MODE.
+See the variable `wcheck-read-or-skip-faces' for more
+information."
+ (cddr (assq mode wcheck-read-or-skip-faces)))
+
+
+(defun wcheck-generate-face-predicate (op-mode faces)
+ "Generate a predicate expression for reading words.
+This function creates a predicate expression which, by evaluating
+it, is used to check whether or not the current match should be
+read or skipped. OP-MODE is either symbol `read' or `skip' and
+FACES is a list of faces. This is only for `wcheck-mode's
+internal use."
+ (cond ((eq 'read op-mode)
+ `(wcheck-face-found-p
+ ',faces (wcheck-collect-faces (match-beginning 1)
+ (match-end 1))))
+ ((eq 'skip op-mode)
+ `(not (wcheck-face-found-p
+ ',faces (wcheck-collect-faces (match-beginning 1)
+ (match-end 1)))))
+ (t)))
+
+
+(defun wcheck-face-found-p (user-faces buffer-faces)
+ "Return t if a symbol in USER-FACES is found from BUFFER-FACES.
+Both arguments are lists."
+ (catch 'found
+ (dolist (face user-faces)
+ (when (member face buffer-faces)
+ (throw 'found t)))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Miscellaneous low-level functions
- [elpa] 160/352: Hiotaan tekstipohjaista oikolukuehdotusvalikkoa, (continued)
- [elpa] 160/352: Hiotaan tekstipohjaista oikolukuehdotusvalikkoa, Stefan Monnier, 2014/07/07
- [elpa] 267/352: Rephrase examples, Stefan Monnier, 2014/07/07
- [elpa] 345/352: Use prefix wcheck-- in internal functions and variables, Stefan Monnier, 2014/07/07
- [elpa] 155/352: Varmistetaan, ettei välilyöntejä tulkita väärin regexpissä, Stefan Monnier, 2014/07/07
- [elpa] 113/352: Muutetaan lukemis- ja maalauspyyntöfunktioiden nimet, Stefan Monnier, 2014/07/07
- [elpa] 333/352: Add a missing "is" to README, Stefan Monnier, 2014/07/07
- [elpa] 262/352: Version 2011.06.29, Stefan Monnier, 2014/07/07
- [elpa] 351/352: Version 2014.6.21, Stefan Monnier, 2014/07/07
- [elpa] 156/352: Tallennetaan ja palautetaan säännöllisten lausekkeiden täsmäystiedot, Stefan Monnier, 2014/07/07
- [elpa] 152/352: Toteutetaan wcheck-combine-overlapping-areas järkevämmin, Stefan Monnier, 2014/07/07
- [elpa] 150/352: Lisätään matalan tason funktiot face-tietojen käsittelyyn,
Stefan Monnier <=
- [elpa] 296/352: Put the subtitle under the main title and modify it a bit, Stefan Monnier, 2014/07/07
- [elpa] 307/352: Add "URL" header which points to GitHub, Stefan Monnier, 2014/07/07
- [elpa] 322/352: Add Makefile to the repository, Stefan Monnier, 2014/07/07
- [elpa] 310/352: Update README.org url in doc string, Stefan Monnier, 2014/07/07
- [elpa] 159/352: Täydennetään funktioiden kuvauksia, Stefan Monnier, 2014/07/07
- [elpa] 275/352: Remove a duplicate sentence from wcheck-language-data doc, Stefan Monnier, 2014/07/07
- [elpa] 167/352: Vaihdetaan näppäimenlukufunktiota read-char-exclusive -> read-key, Stefan Monnier, 2014/07/07
- [elpa] 168/352: Dokumenttien kielellistä hienosäätöä, Stefan Monnier, 2014/07/07
- [elpa] 340/352: Makefile: Only byte-compile wcheck-mode.el, Stefan Monnier, 2014/07/07
- [elpa] 337/352: Use jit-lock-fontify-now instead of font-lock-fontify-region, Stefan Monnier, 2014/07/07