all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: emacs-devel@gnu.org
Subject: Re: [patch]  minor patch for register.el
Date: Wed, 20 Feb 2013 12:05:04 -0500	[thread overview]
Message-ID: <jwvzjyz0w2s.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CFAB57590EFF4945AFF963FB23BB2CA8@us.oracle.com> (Drew Adams's message of "Tue, 19 Feb 2013 15:18:08 -0800")

> 1. Adds functions `register-insertable-p', `register-jumpable-p', and
> `register-printable-p'.

Why are these needed?  The text description of the change sounds good,
but the corresponding code ends up duplicating a lot of `cond' code with
no obvious direct benefit.

The rest of the patch looks good (see further comments below).  Tho,
please don't turn the "(cond\n..." into "(cond ...)" which ends up
reindenting all the code gratuitously.

> @@ -148,12 +194,12 @@
>  delete any existing frames that the frame configuration doesn't mention.
>  \(Otherwise, these frames are iconified.)"
>    (interactive "cJump to register: \nP")
> +  (unless (get-register register)
> +    (error "No such register: `%s'" (single-key-description register)))
> +  (unless (register-jumpable-p register (called-interactively-p 'interactive))
> +    (error "Cannot jump to register `%s'" (single-key-description register)))
>    (let ((val (get-register register)))
> -    (cond
> -     ((registerv-p val)
> -      (cl-assert (registerv-jump-func val) nil
> -              "Don't know how to jump to register %s"
> -              (single-key-description register))
> +    (cond ((registerv-p val)
>        (funcall (registerv-jump-func val) (registerv-data val)))
>       ((and (consp val) (frame-configuration-p (car val)))
>        (set-frame-configuration (car val) (not delete))

Using cl-assert indeed sounds wrong.  It should probably be
a user-error instead.  But what is the benefit of moving the test?

> -	(message "Register %s is empty" (single-key-description register))
> +        (error "No such register: `%s'" (single-key-description register))

Make it a user-error.

> +  (if (null register-alist)
> +      (error "No registers to describe")

Same here.


        Stefan



  parent reply	other threads:[~2013-02-20 17:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 23:18 [patch] minor patch for register.el Drew Adams
2013-02-20  2:18 ` Masatake YAMATO
2013-02-20  4:30   ` Drew Adams
2013-02-20 14:48     ` John Yates
2013-02-20 14:53       ` Christopher Schmidt
2013-02-20 15:27       ` Drew Adams
2013-02-20 17:05 ` Stefan Monnier [this message]
2013-02-20 23:15   ` Drew Adams
2013-03-11 18:01     ` Stefan Monnier
2013-03-11 20:46       ` Drew Adams
2013-02-21 20:29 ` Bastien
2013-02-21 21:20   ` Drew Adams
2013-02-21 21:25     ` Bastien
2013-02-21 21:29       ` Drew Adams
2013-02-21 21:34         ` Drew Adams

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvzjyz0w2s.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=drew.adams@oracle.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.