unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: 2375@emacsbugs.donarmstrong.com
Cc: Harald Maier <harald@maierh.de>
Subject: bug#2375: 23.0.90; ^ in gnus summary buffer does not work in the nextstep build
Date: Thu, 19 Feb 2009 13:29:55 -0500	[thread overview]
Message-ID: <jwv8wo2thb0.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <m2ocwy7gfu.fsf@engster.org> (David Engster's message of "Thu, 19 Feb 2009 13:35:17 +0100")

>> I think the bug is in the definition of ns-unput-working-text (or in
>> the way ns-unput-working-text and ns-unput-working-text (both events
>> and functions) interact).
>> 
>> Not sure why ns-working-overlay was nil in your case, so either
>> ns-unput-working-text should be careful to handle the case where that
>> variable is nil, or some other code should make sure that it can't be
>> nil when we reach ns-unput-working-text.

> It seems this is a bug in ns-insert-working-text, and it's already
> mentioned there in a FIXME comment:

> ;; FIXME: if buffer is read-only, don't try to insert anything
> ;;  and if text is bound to a command, execute that instead (Bug#1453)

> The Gnus group and summary buffers are read only, so what we're dealing
> here seems to be a duplicate of Bug #1453.

What happens after the patch below?  It's not intended to fix #1453.


        Stefan


--- ns-win.el.~1.36.~	2009-02-07 11:23:03.000000000 -0500
+++ ns-win.el	2009-02-19 13:21:57.000000000 -0500
@@ -779,11 +779,11 @@
 
 
 
-;;;; Composed key sequence handling for Nextstep system input methods.
-;;;; (On Nextstep systems, input methods are provided for CJK
-;;;; characters, etc. which require multiple keystrokes, and during
-;;;; entry a partial ("working") result is typically shown in the
-;;;; editing window.)
+;; Composed key sequence handling for Nextstep system input methods.
+;; (On Nextstep systems, input methods are provided for CJK
+;; characters, etc. which require multiple keystrokes, and during
+;; entry a partial ("working") result is typically shown in the
+;; editing window.)
 
 (defface ns-working-text-face
   '((t :underline t))
@@ -791,11 +791,8 @@
   :group 'ns)
 
 (defvar ns-working-overlay nil
-  "Overlay used to highlight working text during compose sequence insert.")
-(make-variable-buffer-local 'ns-working-overlay)
-(defvar ns-working-overlay-len 0
-  "Length of working text during compose sequence insert.")
-(make-variable-buffer-local 'ns-working-overlay-len)
+  "Overlay used to highlight working text during compose sequence insert.
+When text is in th echo area, this just stores the length of the working text.")
 
 (defvar ns-working-text)		; nsterm.m
 
@@ -825,52 +822,52 @@
   (if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
 (defun ns-unput-working-text ()
   (interactive)
-  (if (ns-in-echo-area) (ns-unecho-working-text) (ns-delete-working-text)))
+  (ns-delete-working-text))
 
 (defun ns-insert-working-text ()
-  "Insert contents of ns-working-text as UTF8 string and mark with
-ns-working-overlay.  Any previously existing working text is cleared first.
-The overlay is assigned the face ns-working-text-face."
-;; FIXME: if buffer is read-only, don't try to insert anything
-;;  and if text is bound to a command, execute that instead (Bug#1453)
+  "Insert contents of `ns-working-text' as UTF8 string and mark with
+`ns-working-overlay'.  Any previously existing working text is cleared first.
+The overlay is assigned the face `ns-working-text-face'."
+  ;; FIXME: if buffer is read-only, don't try to insert anything
+  ;;  and if text is bound to a command, execute that instead (Bug#1453)
   (interactive)
-  (if ns-working-overlay (ns-delete-working-text))
+  (ns-delete-working-text)
   (let ((start (point)))
     (insert ns-working-text)
     (overlay-put (setq ns-working-overlay (make-overlay start (point)
 							(current-buffer) nil t))
-		 'face 'ns-working-text-face)
-    (setq ns-working-overlay-len (+ ns-working-overlay-len (- (point) start)))))
+		 'face 'ns-working-text-face)))
 
 (defun ns-echo-working-text ()
   "Echo contents of ns-working-text in message display area.
-See ns-insert-working-text."
-  (if ns-working-overlay (ns-unecho-working-text))
+See `ns-insert-working-text'."
+  (ns-delete-working-text)
   (let* ((msg (current-message))
 	 (msglen (length msg))
 	 message-log-max)
-    (setq ns-working-overlay-len (length ns-working-text))
+    (setq ns-working-overlay (length ns-working-text))
     (setq msg (concat msg ns-working-text))
-    (put-text-property msglen (+ msglen ns-working-overlay-len)
+    (put-text-property msglen (+ msglen ns-working-overlay)
 		       'face 'ns-working-text-face msg)
-    (message "%s" msg)
-    (setq ns-working-overlay t)))
+    (message "%s" msg)))
 
 (defun ns-delete-working-text()
-  "Delete working text and clear ns-working-overlay."
+  "Delete working text and clear `ns-working-overlay'."
   (interactive)
-  (delete-backward-char ns-working-overlay-len)
-  (setq ns-working-overlay-len 0)
-  (delete-overlay ns-working-overlay))
-
-(defun ns-unecho-working-text()
-  "Delete working text from echo area and clear ns-working-overlay."
+  (cond
+   ((and (overlayp ns-working-overlay)
+         ;; Still alive?
+         (overlay-buffer ns-working-overlay))
+    (with-current-buffer (overlay-buffer ns-working-overlay)
+      (delete-region (overlay-start ns-working-overlay)
+                     (overlay-end ns-working-overlay))
+      (delete-overlay ns-working-overlay)))
+   ((integerp ns-working-overlay)
   (let ((msg (current-message))
 	message-log-max)
-    (setq msg (substring msg 0 (- (length msg) ns-working-overlay-len)))
-    (message "%s" msg)
-    (setq ns-working-overlay-len 0)
-    (setq ns-working-overlay nil)))
+      (setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
+      (message "%s" msg))))
+  (setq ns-working-overlay nil))
 
 
 (declare-function ns-convert-utf8-nfd-to-nfc "nsfns.m" (str))






  reply	other threads:[~2009-02-19 18:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-18 18:27 bug#2375: 23.0.90; ^ in gnus summary buffer does not work in the nextstep build Harald Maier
2009-02-18 21:15 ` David Engster
2009-02-18 23:51   ` Stefan Monnier
2009-02-19 12:35     ` David Engster
2009-02-19 18:29       ` Stefan Monnier [this message]
2009-02-20  3:46         ` Harald Maier
2009-02-20 13:03         ` David Engster
2009-02-20 15:18           ` Stefan Monnier
2009-02-20 15:41             ` David Engster
2009-02-20 21:14               ` Stefan Monnier
2009-02-21  0:45                 ` David Engster
2009-02-21  4:56                 ` Harald Maier
2009-02-21  6:38                   ` YAMAMOTO Mitsuharu
2009-02-21  9:30                     ` Harald Maier
2009-02-22  1:39                       ` YAMAMOTO Mitsuharu
2009-02-24  5:00                         ` Harald Maier
2009-02-24  5:09                           ` YAMAMOTO Mitsuharu
2009-02-25 16:25                     ` Stefan Monnier
2009-02-26  0:04                       ` YAMAMOTO Mitsuharu
2009-02-26 15:21                         ` Stefan Monnier
2009-02-27  0:09                           ` YAMAMOTO Mitsuharu
2009-03-09 13:25                             ` Stefan Monnier
2009-03-10  0:05                               ` YAMAMOTO Mitsuharu
2009-03-10 17:18                                 ` Stefan Monnier
2015-02-13  7:18                           ` Lars Ingebrigtsen
2016-01-21 23:31                             ` Alan Third
2009-02-26 16:49                       ` David Engster

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=jwv8wo2thb0.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=2375@emacsbugs.donarmstrong.com \
    --cc=harald@maierh.de \
    /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).