* bug#27424: 24.5; [PATCH] commands `apropos-local-variable', `apropos-local-value'
[not found] ` <<83o9sc8stc.fsf@gnu.org>
@ 2017-07-22 23:29 ` Drew Adams
2017-07-28 7:49 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2017-07-22 23:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 27424
> In general, NEWS entries for new commands just need to name the
> commands, and optionally say a sentence about what they do. The idea
> is that the details will be picked up from the doc strings.
For NEWS:
New commands `apropos-local-variable' and `apropos-local-value,
which are buffer-local versions of `apropos-variable' and
`apropos-value'. They show buffer-local variables who names
and values, respectively, match a given pattern.
For the Emacs manual, node `Apropos':
`M-x apropos-local-variable'
Search for buffer-local variables whose names match
the specified pattern.
`M-x apropos-local-value'
Search for buffer-local variables whose values match
the specified pattern.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27424: 24.5; [PATCH] commands `apropos-local-variable', `apropos-local-value'
2017-07-22 23:29 ` bug#27424: 24.5; [PATCH] commands `apropos-local-variable', `apropos-local-value' Drew Adams
@ 2017-07-28 7:49 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-07-28 7:49 UTC (permalink / raw)
To: Drew Adams; +Cc: 27424-done
> Date: Sat, 22 Jul 2017 16:29:13 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: 27424@debbugs.gnu.org
>
> > In general, NEWS entries for new commands just need to name the
> > commands, and optionally say a sentence about what they do. The idea
> > is that the details will be picked up from the doc strings.
>
> For NEWS:
>
> New commands `apropos-local-variable' and `apropos-local-value,
> which are buffer-local versions of `apropos-variable' and
> `apropos-value'. They show buffer-local variables who names
> and values, respectively, match a given pattern.
>
> For the Emacs manual, node `Apropos':
>
> `M-x apropos-local-variable'
> Search for buffer-local variables whose names match
> the specified pattern.
>
> `M-x apropos-local-value'
> Search for buffer-local variables whose values match
> the specified pattern.
Thanks, pushed to master.
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <<5d980f35-f43a-4968-8f59-d86acb06cca1@default>]
* bug#27424: 24.5; [PATCH] commands `apropos-local-variable', `apropos-local-value'
@ 2017-06-18 21:33 Drew Adams
2017-07-22 8:01 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2017-06-18 21:33 UTC (permalink / raw)
To: 27424
[-- Attachment #1: Type: text/plain, Size: 278 bytes --]
See attached patch for two apropos commands for buffer-local variables.
In GNU Emacs 24.5.1 (i686-pc-mingw32)
of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --prefix=/c/usr --host=i686-pc-mingw32'
[-- Attachment #2: apropos-2017-06-18.patch --]
[-- Type: application/octet-stream, Size: 2639 bytes --]
diff -u apropos.el apropos-patched.el
--- apropos.el 2017-06-18 14:23:30.026469800 -0700
+++ apropos-patched.el 2017-06-18 14:27:17.814246300 -0700
@@ -514,6 +514,19 @@
(let ((apropos-do-all (if do-not-all nil t)))
(apropos-user-option pattern)))
+;;;###autoload
+(defun apropos-local-variable (pattern &optional buffer)
+ "Show buffer-local variables that match PATTERN.
+Optional arg BUFFER (default: current buffer) is the buffer to check.
+
+The output includes variables that are not yet set in BUFFER, but that
+will be buffer-local when set."
+ (interactive (list (apropos-read-pattern "buffer-local variable")))
+ (unless buffer (setq buffer (current-buffer)))
+ (apropos-command pattern nil (lambda (symbol)
+ (and (local-variable-if-set-p symbol)
+ (get symbol 'variable-documentation)))))
+
;; For auld lang syne:
;;;###autoload
(defalias 'command-apropos 'apropos-command)
@@ -795,6 +808,35 @@
(let ((apropos-multi-type do-all))
(apropos-print nil "\n----------------\n")))
+;;;###autoload
+(defun apropos-local-value (pattern &optional buffer)
+ "Show buffer-local variables whose values match PATTERN.
+This is like `apropos-value', but for only buffer-local variables.
+Optional arg BUFFER (default: current buffer) is the buffer to check."
+ (interactive (list (apropos-read-pattern "value of buffer-local variable")))
+ (unless buffer (setq buffer (current-buffer)))
+ (apropos-parse-pattern pattern)
+ (setq apropos-accumulator ())
+ (let ((var nil))
+ (mapatoms
+ (lambda (symb)
+ (unless (memq symb '(apropos-regexp apropos-pattern apropos-all-words-regexp
+ apropos-words apropos-all-words apropos-accumulator symb var))
+ (setq var (apropos-value-internal 'local-variable-if-set-p symb 'symbol-value)))
+ (when (and (fboundp 'apropos-false-hit-str) (apropos-false-hit-str var))
+ (setq var nil))
+ (when var
+ (setq apropos-accumulator (cons (list symb (apropos-score-str var) nil var)
+ apropos-accumulator))))))
+ (let ((apropos-multi-type nil))
+ (if (> emacs-major-version 20)
+ (apropos-print
+ nil "\n----------------\n"
+ (format "Buffer `%s' has the following local variables\nmatching %s`%s':"
+ (buffer-name buffer)
+ (if (consp pattern) "keywords " "")
+ pattern))
+ (apropos-print nil "\n----------------\n"))))
;;;###autoload
(defun apropos-documentation (pattern &optional do-all)
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27424: 24.5; [PATCH] commands `apropos-local-variable', `apropos-local-value'
2017-06-18 21:33 Drew Adams
@ 2017-07-22 8:01 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-07-22 8:01 UTC (permalink / raw)
To: Drew Adams; +Cc: 27424
> Date: Sun, 18 Jun 2017 14:33:46 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
>
> See attached patch for two apropos commands for buffer-local variables.
Thanks, this LGTM. Could you please add corresponding changes for the
documentation: the Emacs manual and NEWS? I will then install all of
that.
P.S. Sorry for a long delay in replying to your message.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-28 7:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <<<5d980f35-f43a-4968-8f59-d86acb06cca1@default>
[not found] ` <<<83d18saoi4.fsf@gnu.org>
[not found] ` <<1610052b-f79c-485d-93e7-cc1d97961a26@default>
[not found] ` <<83o9sc8stc.fsf@gnu.org>
2017-07-22 23:29 ` bug#27424: 24.5; [PATCH] commands `apropos-local-variable', `apropos-local-value' Drew Adams
2017-07-28 7:49 ` Eli Zaretskii
[not found] <<5d980f35-f43a-4968-8f59-d86acb06cca1@default>
[not found] ` <<83d18saoi4.fsf@gnu.org>
2017-07-22 13:59 ` Drew Adams
2017-07-22 14:11 ` Eli Zaretskii
2017-06-18 21:33 Drew Adams
2017-07-22 8:01 ` Eli Zaretskii
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).