From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: ampc back on elpa?
Date: Mon, 13 Jun 2016 08:45:16 -0400 [thread overview]
Message-ID: <jwva8ipl1e8.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 575abfdd.697ac20a.d9403.5ca0@mx.google.com
> I adapted my code to the elpa ampc version. Patch follows. I'm not a skilled
> lisp developer, feel free to comment.
Looks pretty good, except for one spot that doesn't seem right. See below.
Stefan
> @@ -569,6 +573,13 @@ modified."
> (0.4 playlist ,@pl-prop)
> (1.0 playlists)))
> ,rs_b)
> + ("Search view"
> + ,(kbd "F")
> + horizontal
> + (0.4 vertical
> + (6 status)
> + (1.0 current-playlist ,@pl-prop))
> + ,search-view)
> ("Outputs view"
> ,(kbd "L")
> outputs :properties (("outputname" :title "Name" :min 10 :max 30)
Indentation looks odd here. Maybe a mix of spaces and tabs?
> (defmacro ampc-iterate-source-output (delimiter bindings pad-data &rest body)
> + "delimiter = what delimit command results in mpd response"
Thank you for helping document the code. Could you add a first line
describing of the general functionality? Also put `delimiter` in
all-caps since that's the convention used in Emacs for function/macro
arguments in docstrings.
> @@ -1507,6 +1535,14 @@ modified."
> (ampc-send-command 'currentsong))
> (playlists
> (ampc-send-command 'listplaylists))
> + (search
> + (if (active-minibuffer-window) ;can't find a better way to check minibuffer
> + (when ampc-search-keywords
> + (ampc-send-command 'search nil "any" (ampc-quote ampc-search-keywords)))
> + (let ((search (read-from-minibuffer "Keywords: ")))
> + (unless (string= "" search)
> + (setq ampc-search-keywords search)
> + (ampc-send-command 'search nil "any" (ampc-quote search))))))
> (current-playlist
> (ampc-send-command 'playlistinfo))))))
> (ampc-send-command 'status)
Can you rewrite it to something like
(search
(unless (active-minibuffer-window)
;; Can't find a better way to check minibuffer
(let ((search (read-from-minibuffer "Keywords: ")))
(setq ampc-search-keywords
(unless (string= "" search) search))))
(when ampc-search-keywords
(ampc-send-command 'search nil "any"
(ampc-quote ampc-search-keywords))))
But in any case, this looks fishy. `ampc-update` doesn't seem like
a good place to have user interaction. Why do you need to
`read-from-minibuffer` *here* (BTW, I recommend you use `read-string`
instead)? I mean, why can't you set ampc-search-keywords elsewhere?
Stefan
next prev parent reply other threads:[~2016-06-13 12:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-14 16:31 ampc back on elpa? Cédric Chépied
2016-05-14 14:48 ` Stefan Monnier
2016-05-25 6:07 ` Cédric Chépied
2016-05-25 8:32 ` Stefan Monnier
2016-06-10 13:25 ` Cédric Chépied
2016-06-10 15:52 ` Stefan Monnier
2016-06-13 7:23 ` Cédric Chépied
2016-06-13 12:45 ` Stefan Monnier [this message]
2016-06-15 9:53 ` Cédric Chépied
2016-06-15 13:35 ` Stefan Monnier
2016-06-17 16:43 ` Cédric Chépied
2016-06-17 22:28 ` Stefan Monnier
2016-06-20 11:47 ` Cédric Chépied
2016-07-01 11:25 ` Cédric Chépied
2016-07-27 13:58 ` Cédric Chépied
2016-07-27 14:40 ` Stefan Monnier
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=jwva8ipl1e8.fsf-monnier+gmane.emacs.devel@gnu.org \
--to=monnier@iro.umontreal.ca \
--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).