From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Widgets and text-changing Date: Thu, 18 Jun 2009 01:03:20 +0200 Message-ID: <87ocsm79af.fsf@escher.local.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1245279847 11559 80.91.229.12 (17 Jun 2009 23:04:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2009 23:04:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 18 01:04:03 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MH4Al-0002dQ-I1 for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jun 2009 01:04:03 +0200 Original-Received: from localhost ([127.0.0.1]:51040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MH4Al-0002Vg-3S for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jun 2009 19:04:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MH4AP-0002Tt-Rh for help-gnu-emacs@gnu.org; Wed, 17 Jun 2009 19:03:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MH4AL-0002Rp-Dg for help-gnu-emacs@gnu.org; Wed, 17 Jun 2009 19:03:41 -0400 Original-Received: from [199.232.76.173] (port=57971 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MH4AL-0002Rl-92 for help-gnu-emacs@gnu.org; Wed, 17 Jun 2009 19:03:37 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:50922 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MH4AJ-0006DP-UD for help-gnu-emacs@gnu.org; Wed, 17 Jun 2009 19:03:36 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MH4AH-0005DK-IB for help-gnu-emacs@gnu.org; Wed, 17 Jun 2009 23:03:33 +0000 Original-Received: from i59f54ecc.versanet.de ([89.245.78.204]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jun 2009 23:03:33 +0000 Original-Received: from stephen.berman by i59f54ecc.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Jun 2009 23:03:33 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: i59f54ecc.versanet.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65358 Archived-At: Is it possible to apply text-changing commands or functions to widgets in a buffer without dewidgetizing them? For example, if I eval this sexp: (with-current-buffer (get-buffer-create "*Widget Test*") (setq mylist '("delta" "alfa" "charlie" "bravo")) (switch-to-buffer (current-buffer)) (erase-buffer) (kill-all-local-variables) (mapc (lambda (elt) (widget-create 'push-button :notify (lambda (&rest ignore) (message "Test")) elt) (widget-insert "\n")) mylist) ;; (sort-lines nil (point-min) (point-max)) (use-local-map widget-keymap) (widget-setup)) then the buffer *Widget Test* contains these widgets, which are in bold face, have mouse-face highlighting, and are active (clicking them displays the message "Test"): [delta] [alfa] [charlie] [bravo] If I now try to modify this buffer, e.g. with sort-lines, this fails with the error: widget-before-change: Text is read-only: "Attempt to change text outside editable field" If I uncomment the commented line in the above sexp and eval it again, then the lines in *Widget Test* are alphabetized: [alfa] [bravo] [charlie] [delta] but dewidgetized: no bold face, no hightlighting, not active. Is it possible to manipulate, e.g. sort, widgets in a buffer without them losing their widgetry? Steve Berman