From unknown Sun Aug 17 10:21:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14134: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode Resent-From: Erik Knowles Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Apr 2013 20:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14134 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 14134@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136502017919299 (code B ref -1); Wed, 03 Apr 2013 20:17:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Apr 2013 20:16:19 +0000 From: Erik Knowles Date: Wed, 3 Apr 2013 14:03:36 -0600 Message-Id: <20134314336.903334@A6> X-Mailer: Barca 2.8 (4400) - Licensed Version Delphi mode's fontification code erases all existing text properties, including those used by highlight changes mode to mark modified text sections. To duplicate: emacs -Q M-x delphi-mode M-x highlight-changes-mode M-x highlight-changes-visible-mode M-x highlight-changes-visible-mode I've not included a proper patch (intuitively, the "correct" fix would be to rewrite Delphi mode's fontification code to use overlays) because I'm not experienced enough with Elisp to do a proper job; however, I've personally worked around the problem by monkey patching as follows: -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ ;; Delphi-mode marks literals with special text properties, in the process borking *all* ;; existing properties including the properties used by hilit-chg mode for marking ;; changes even when the "changes visible" flag is off. To avoid this, the mode's ;; "delphi-set-text-properties" function is replaced here with a version that simply ;; removes the specific text properties used by the font lock while leaving all the ;; other properties alone. ;; ;; To do this delphi-set-text-properties simply tracks which faces are used by the Delphi ;; font lock code and only removes those faces (setq delphi-used-faces (list)) (defun delphi-set-text-properties (from to properties) ;; Like `set-text-properties', except we do not consider this to be a buffer ;; modification. (delphi-save-state (dolist (prop delphi-used-faces) (remove-text-properties from to prop)) (when properties (add-text-properties from to properties) (add-to-list 'delphi-used-faces properties) ) ) ) -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ In GNU Emacs 24.3.1 (i686-pc-cygwin) of 2013-03-11 on fiona Configured using: `configure '--srcdir=/home/kbrown/src/cygemacs/emacs-24.3-1/src/emacs-24.3' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--datadir=/usr/share' '--localstatedir=/var' '--sysconfdir=/etc' '--datarootdir=/usr/share' '--docdir=/usr/share/doc/emacs' '-C' '--with-x=no' 'CC=gcc' 'CFLAGS=-ggdb -O2 -pipe -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-1/build=/usr/src/debug/emacs-24.3-1 -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-1/src/emacs-24.3=/usr/src/debug/emacs-24.3-1' 'LDFLAGS=-L/usr/lib/ncursesw' 'LIBS=' 'CPPFLAGS=-I/usr/include/ncursesw'' Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: flyspell-mode: t shell-dirtrack-mode: t mouse-wheel-mode: t xterm-mouse-mode: t global-subword-mode: t subword-mode: t cua-mode: t desktop-save-mode: t show-paren-mode: t global-highlight-changes-mode: t highlight-changes-mode: t which-function-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t auto-fill-function: do-auto-fill transient-mark-mode: t Load-path shadows: /home/Erik/.emacs.d/indent hides /usr/share/emacs/24.3/lisp/indent Features: (shadow gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils server flyspell ispell ido tempbuf grep-a-lot grep bash-completion shell pcomplete init-terminal-fix saveplace tabbar mwheel xt-mouse backup-dir backup-each-save pascal-mode+ delphi pascal subword org-install xterm-title xterm-frobs goto-last-change cua-base sunrise-commander easy-mmode term ehelp electric sort find-dired esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-util esh-module esh-mode disp-table enriched dired-x easymenu dired-aux dired desktop paren hl-line+ advice help-fns cl-lib advice-preload time-date hl-line hilit-chg wid-edit which-func imenu edmacro kmacro warnings byte-opt compile comint regexp-opt ansi-color ring tool-bar bytecomp byte-compile cconv bash-completion-autoloads cygwin-mount-autoloads dired+-autoloads flymake-cursor-autoloads flymake-python-pyflakes-autoloads flymake-easy-autoloads grep-a-lot-autoloads hl-line+-autoloads icicles-autoloads pager-autoloads tabbar-autoloads tidy-autoloads package ediff-hook vc-hooks lisp-float-type tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind multi-tty emacs) - Erik R. Knowles From unknown Sun Aug 17 10:21:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14134: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Apr 2013 20:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14134 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Erik Knowles Cc: 14134@debbugs.gnu.org Received: via spool by 14134-submit@debbugs.gnu.org id=B14134.136683673510139 (code B ref 14134); Wed, 24 Apr 2013 20:53:01 +0000 Received: (at 14134) by debbugs.gnu.org; 24 Apr 2013 20:52:15 +0000 Received: from localhost ([127.0.0.1]:41616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV6fm-0002dS-Ss for submit@debbugs.gnu.org; Wed, 24 Apr 2013 16:52:15 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:30037) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UV6fk-0002dI-A5 for 14134@debbugs.gnu.org; Wed, 24 Apr 2013 16:52:12 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJBOICwbBLY0ag3ADpHqBXoMTgUs X-IPAS-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJBOICwbBLY0ag3ADpHqBXoMTgUs X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="8218015" Received: from 69-165-134-22.dsl.teksavvy.com (HELO pastel.home) ([69.165.134.22]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 24 Apr 2013 16:47:03 -0400 Received: by pastel.home (Postfix, from userid 20848) id 900A367A3A; Wed, 24 Apr 2013 16:47:06 -0400 (EDT) From: Stefan Monnier Message-ID: References: <20134314336.903334@A6> Date: Wed, 24 Apr 2013 16:47:06 -0400 In-Reply-To: <20134314336.903334@A6> (Erik Knowles's message of "Wed, 3 Apr 2013 14:03:36 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > 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 + + * 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 * 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") From unknown Sun Aug 17 10:21:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Erik Knowles Subject: bug#14134: closed (Re: bug#14134: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode) Message-ID: References: <20134314336.903334@A6> X-Gnu-PR-Message: they-closed 14134 X-Gnu-PR-Package: emacs Reply-To: 14134@debbugs.gnu.org Date: Thu, 25 Apr 2013 16:24:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1366907042-16033-1" This is a multi-part message in MIME format... ------------=_1366907042-16033-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #14134: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 14134@debbugs.gnu.org. --=20 14134: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14134 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1366907042-16033-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 14134-done) by debbugs.gnu.org; 25 Apr 2013 16:23:02 +0000 Received: from localhost ([127.0.0.1]:43272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UVOwn-00048Z-J6 for submit@debbugs.gnu.org; Thu, 25 Apr 2013 12:23:01 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:59241) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UVOwl-00048G-IB for 14134-done@debbugs.gnu.org; Thu, 25 Apr 2013 12:23:00 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFpYYW/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="8289172" Received: from 69-165-134-22.dsl.teksavvy.com (HELO pastel.home) ([69.165.134.22]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Apr 2013 12:17:45 -0400 Received: by pastel.home (Postfix, from userid 20848) id 98F3367A20; Thu, 25 Apr 2013 12:17:49 -0400 (EDT) From: Stefan Monnier To: Erik Knowles Subject: Re: bug#14134: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode Message-ID: References: <20134314336.903334@A6> Date: Thu, 25 Apr 2013 12:17:49 -0400 In-Reply-To: <20134314336.903334@A6> (Erik Knowles's message of "Wed, 3 Apr 2013 14:03:36 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14134-done Cc: 14134-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) This should be all fixed now: I changed opascal-mode to use syntax-propertize and font-lock "in the normal way". Stefan ------------=_1366907042-16033-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 3 Apr 2013 20:16:19 +0000 From: Erik Knowles Subject: 24.3; Delphi Mode Doesn't Work With Highlight Changes Mode To: bug-gnu-emacs@gnu.org Date: Wed, 3 Apr 2013 14:03:36 -0600 Message-Id: <20134314336.903334@A6> X-Debbugs-Envelope-To: submit X-Mailer: Barca 2.8 (4400) - Licensed Version Delphi mode's fontification code erases all existing text properties, including those used by highlight changes mode to mark modified text sections. To duplicate: emacs -Q M-x delphi-mode M-x highlight-changes-mode M-x highlight-changes-visible-mode M-x highlight-changes-visible-mode I've not included a proper patch (intuitively, the "correct" fix would be to rewrite Delphi mode's fontification code to use overlays) because I'm not experienced enough with Elisp to do a proper job; however, I've personally worked around the problem by monkey patching as follows: -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ ;; Delphi-mode marks literals with special text properties, in the process borking *all* ;; existing properties including the properties used by hilit-chg mode for marking ;; changes even when the "changes visible" flag is off. To avoid this, the mode's ;; "delphi-set-text-properties" function is replaced here with a version that simply ;; removes the specific text properties used by the font lock while leaving all the ;; other properties alone. ;; ;; To do this delphi-set-text-properties simply tracks which faces are used by the Delphi ;; font lock code and only removes those faces (setq delphi-used-faces (list)) (defun delphi-set-text-properties (from to properties) ;; Like `set-text-properties', except we do not consider this to be a buffer ;; modification. (delphi-save-state (dolist (prop delphi-used-faces) (remove-text-properties from to prop)) (when properties (add-text-properties from to properties) (add-to-list 'delphi-used-faces properties) ) ) ) -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ In GNU Emacs 24.3.1 (i686-pc-cygwin) of 2013-03-11 on fiona Configured using: `configure '--srcdir=/home/kbrown/src/cygemacs/emacs-24.3-1/src/emacs-24.3' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--datadir=/usr/share' '--localstatedir=/var' '--sysconfdir=/etc' '--datarootdir=/usr/share' '--docdir=/usr/share/doc/emacs' '-C' '--with-x=no' 'CC=gcc' 'CFLAGS=-ggdb -O2 -pipe -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-1/build=/usr/src/debug/emacs-24.3-1 -fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-24.3-1/src/emacs-24.3=/usr/src/debug/emacs-24.3-1' 'LDFLAGS=-L/usr/lib/ncursesw' 'LIBS=' 'CPPFLAGS=-I/usr/include/ncursesw'' Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: flyspell-mode: t shell-dirtrack-mode: t mouse-wheel-mode: t xterm-mouse-mode: t global-subword-mode: t subword-mode: t cua-mode: t desktop-save-mode: t show-paren-mode: t global-highlight-changes-mode: t highlight-changes-mode: t which-function-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t auto-fill-function: do-auto-fill transient-mark-mode: t Load-path shadows: /home/Erik/.emacs.d/indent hides /usr/share/emacs/24.3/lisp/indent Features: (shadow gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils server flyspell ispell ido tempbuf grep-a-lot grep bash-completion shell pcomplete init-terminal-fix saveplace tabbar mwheel xt-mouse backup-dir backup-each-save pascal-mode+ delphi pascal subword org-install xterm-title xterm-frobs goto-last-change cua-base sunrise-commander easy-mmode term ehelp electric sort find-dired esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell esh-util esh-module esh-mode disp-table enriched dired-x easymenu dired-aux dired desktop paren hl-line+ advice help-fns cl-lib advice-preload time-date hl-line hilit-chg wid-edit which-func imenu edmacro kmacro warnings byte-opt compile comint regexp-opt ansi-color ring tool-bar bytecomp byte-compile cconv bash-completion-autoloads cygwin-mount-autoloads dired+-autoloads flymake-cursor-autoloads flymake-python-pyflakes-autoloads flymake-easy-autoloads grep-a-lot-autoloads hl-line+-autoloads icicles-autoloads pager-autoloads tabbar-autoloads tidy-autoloads package ediff-hook vc-hooks lisp-float-type tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind multi-tty emacs) - Erik R. Knowles ------------=_1366907042-16033-1--