A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01053.html below:

Re: Modifying a variable from describe-variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] From: João Távora Subject: Re: Modifying a variable from describe-variable Date: Sat, 11 Jan 2014 10:12:38 +0000 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
Tom <address@hidden> writes:

> Ivan Andrus <darthandrus <at> 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))







RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4