From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: Modifying a variable from describe-variable Date: Sat, 11 Jan 2014 10:12:38 +0000 Message-ID: <87fvouzv1l.fsf@gmail.com> References: <40518EF2-01D7-4F2B-B3BE-9B0686D3DE3D@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389435338 32284 80.91.229.3 (11 Jan 2014 10:15:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jan 2014 10:15:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tom Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 11 11:15:43 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W1vbT-000797-FK for ged-emacs-devel@m.gmane.org; Sat, 11 Jan 2014 11:15:43 +0100 Original-Received: from localhost ([::1]:60857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1vbS-0004lh-Vi for ged-emacs-devel@m.gmane.org; Sat, 11 Jan 2014 05:15:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1vag-0003Px-4p for emacs-devel@gnu.org; Sat, 11 Jan 2014 05:15:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1vaW-0006wW-FL for emacs-devel@gnu.org; Sat, 11 Jan 2014 05:14:54 -0500 Original-Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:46268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1vaW-0006wM-90 for emacs-devel@gnu.org; Sat, 11 Jan 2014 05:14:44 -0500 Original-Received: by mail-we0-f181.google.com with SMTP id u56so2642247wes.40 for ; Sat, 11 Jan 2014 02:14:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=LqqMlQw1bzSf8bMlIfIuVCJV7/CI0oOV4dIiVRR0L1Q=; b=m6VGfd0Jb6yrVia25ZTmiK+xWMEu/cu+fdw+KX0MjZdCon3PtsmZwu87mPg0rE+fl6 AVRUHDlOEjs5yMg4HaUjTzn3N9YM+l5DG1qtV7yhnq039AMfpfQQMbB+fjjS4aESzJKK aowciWud0ZgyON2OSHLI2IN69EEjdzVkSrn8XZ2r0exATHsOEhf2D7uzeRFkrMoALccD wr/r3gZ1q7lGeberMP0YnR3OnN0gh5y6RdfZgaiqNF3MqFc0La6wXixh2MsS8aJPm4xb +GhVdofksAwCa/uZfh84V85aWiMrVTuaeWJ3HjCtGuQF+wPYBxJ5QSqjIU65t5GCVyjX Rs1A== X-Received: by 10.194.142.174 with SMTP id rx14mr12613841wjb.45.1389435283257; Sat, 11 Jan 2014 02:14:43 -0800 (PST) Original-Received: from kitaj.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id gz5sm6958840wib.10.2014.01.11.02.14.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 11 Jan 2014 02:14:42 -0800 (PST) In-Reply-To: (Tom's message of "Sat, 11 Jan 2014 06:50:08 +0000 (UTC)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168071 Archived-At: Tom writes: > Ivan Andrus gmail.com> writes: >> >> Even simpler (to implement) would be a binding to customize-variable. Of > course, it might not always work, >> but might be preferable to some people in the cases when it does work. > Both could be provided. c - customize and e - edit (for advanced users). > I'd prefer editing the lisp value directly, since I never use customize > and as you also mention it does not work for all variables. This is so good I've already hacked it for me. No idea if I'm doing it correctly though... Thanks a lot for the idea. === modified file 'lisp/help-fns.el' --- lisp/help-fns.el 2013-12-07 17:05:38 +0000 +++ lisp/help-fns.el 2014-01-11 10:10:18 +0000 @@ -711,6 +711,15 @@ version package)))))) output)) +(defvar describe-described-variable nil + "Symbol naming the variable described by `describe-variable'") + +(defun describe-edit-variable () + (interactive) + (set describe-described-variable + (call-interactively 'eval-expression)) + (revert-buffer t t t)) + ;;;###autoload (defun describe-variable (variable &optional buffer frame) "Display the full documentation of VARIABLE (a symbol). @@ -753,6 +762,11 @@ (help-setup-xref (list #'describe-variable variable buffer) (called-interactively-p 'interactive)) (with-help-window (help-buffer) + (setq-local describe-described-variable variable) + (let ((map (make-sparse-keymap))) + (set-keymap-parent map help-mode-map) + (define-key map (kbd "e") 'describe-edit-variable) + (use-local-map map)) (with-current-buffer buffer (prin1 variable) (setq file-name (find-lisp-object-file-name variable 'defvar))