unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: joaotavora@gmail.com (João Távora)
To: Tom <adatgyujto@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Modifying a variable from describe-variable
Date: Sat, 11 Jan 2014 10:12:38 +0000	[thread overview]
Message-ID: <87fvouzv1l.fsf@gmail.com> (raw)
In-Reply-To: <loom.20140111T074628-937@post.gmane.org> (Tom's message of "Sat,  11 Jan 2014 06:50:08 +0000 (UTC)")

Tom <adatgyujto@gmail.com> 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))







  reply	other threads:[~2014-01-11 10:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10 20:16 Modifying a variable from describe-variable Tom
2014-01-11  0:02 ` Stefan Monnier
2014-01-11  4:14 ` Ivan Andrus
2014-01-11  4:22   ` Daniel Colascione
2014-01-11  5:18   ` Stefan Monnier
2014-01-11  6:50   ` Tom
2014-01-11 10:12     ` João Távora [this message]
2014-01-11 16:45       ` Tom
2014-01-12  2:34         ` João Távora
2014-01-12  6:41           ` Tom
2014-01-12 22:44             ` Stefan Monnier
2014-01-13  6:49               ` Tom
2014-01-12 20:51           ` Josh
2014-01-11 10:25     ` martin rudalics
2014-01-11 10:29       ` David Kastrup
2014-01-11 14:00         ` martin rudalics
2014-01-11 14:08           ` David Kastrup
2014-01-11 16:50             ` Tom

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=87fvouzv1l.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=adatgyujto@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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).