unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Erik Knowles <eknowles@geosystemsoftware.com>
Cc: 14134@debbugs.gnu.org
Subject: bug#14134: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode
Date: Wed, 24 Apr 2013 16:47:06 -0400	[thread overview]
Message-ID: <jwv7gjr1wvs.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20134314336.903334@A6> (Erik Knowles's message of "Wed, 3 Apr 2013 14:03:36 -0600")

> Delphi mode's fontification code erases all existing text properties,
> including those used by highlight changes mode to mark modified
> text sections. 

I think your "monkey" patch was actually a fairly good idea.
I installed the patch below instead, which seems a bit cleaner.
I don't think this is quite good enough, but it's a step in the
right direction.


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2013-04-24 14:35:59 +0000
+++ lisp/ChangeLog	2013-04-24 20:40:19 +0000
@@ -1,3 +1,11 @@
+2013-04-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/opascal.el (opascal-set-token-property): Rename from
+	opascal-set-text-properties and only set `token' (bug#14134).
+	(opascal-literal-text-properties): Remove.
+	(opascal-parse-next-literal, opascal-debug-unparse-buffer):
+	Adjust callers.
+
 2013-04-24  Reuben Thomas <rrt@sc3d.org>
 
 	* textmodes/remember.el (remember-handler-functions): Add an

=== modified file 'lisp/progmodes/opascal.el'
--- lisp/progmodes/opascal.el	2013-01-31 01:58:24 +0000
+++ lisp/progmodes/opascal.el	2013-04-24 20:38:48 +0000
@@ -406,11 +406,11 @@
 non-OPascal buffer.  Set to nil in OPascal buffers.  To override, just do:
  (let ((opascal--ignore-changes t)) ...)")
 
-(defun opascal-set-text-properties (from to properties)
+(defun opascal-set-token-property (from to value)
   ;; Like `set-text-properties', except we do not consider this to be a buffer
   ;; modification.
   (opascal-save-state
-   (set-text-properties from to properties)))
+   (put-text-property from to 'token value)))
 
 (defun opascal-literal-kind (p)
   ;; Returns the literal kind the point p is in (or nil if not in a literal).
@@ -490,13 +490,6 @@
       (re-search-forward pattern limit 'goto-limit-on-fail)
       (point))))
 
-(defun opascal-literal-text-properties (kind)
-  ;; Creates a list of text properties for the literal kind.
-  (if (and (boundp 'font-lock-mode)
-           font-lock-mode)
-      (list 'token kind 'face (opascal-face-of kind) 'lazy-lock t)
-    (list 'token kind)))
-
 (defun opascal-parse-next-literal (limit)
   ;; Searches for the next literal region (i.e. comment or string) and sets the
   ;; the point to its end (or the limit, if not found). The literal region is
@@ -507,8 +500,7 @@
            ;; We are completing an incomplete literal.
            (let ((kind (opascal-literal-kind (1- search-start))))
              (opascal-complete-literal kind limit)
-             (opascal-set-text-properties
-              search-start (point) (opascal-literal-text-properties kind))))
+             (opascal-set-token-property search-start (point) kind)))
 
           ((re-search-forward
             "\\(//\\)\\|\\({\\)\\|\\((\\*\\)\\|\\('\\)\\|\\(\"\\)"
@@ -520,13 +512,12 @@
                              ((match-beginning 4) 'string)
                              ((match-beginning 5) 'double-quoted-string)))
                  (start (match-beginning 0)))
-             (opascal-set-text-properties search-start start nil)
+             (opascal-set-token-property search-start start nil)
              (opascal-complete-literal kind limit)
-             (opascal-set-text-properties
-              start (point) (opascal-literal-text-properties kind))))
+             (opascal-set-token-property start (point) kind)))
 
           ;; Nothing found. Mark it as a non-literal.
-          ((opascal-set-text-properties search-start limit nil)))
+          ((opascal-set-token-property search-start limit nil)))
     (opascal-step-progress (point) "Parsing" opascal-parsing-progress-step)))
 
 (defun opascal-literal-token-at (p)
@@ -1570,7 +1561,7 @@
 
 (defun opascal-debug-unparse-buffer ()
   (interactive)
-  (opascal-set-text-properties (point-min) (point-max) nil))
+  (opascal-set-token-property (point-min) (point-max) nil))
 
 (defun opascal-debug-parse-region (from to)
   (interactive "r")






  reply	other threads:[~2013-04-24 20:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03 20:03 bug#14134: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode Erik Knowles
2013-04-24 20:47 ` Stefan Monnier [this message]
2013-04-25 16:17 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7gjr1wvs.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=14134@debbugs.gnu.org \
    --cc=eknowles@geosystemsoftware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).