emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: [patch] Improved block insertion
Date: Sun, 08 Apr 2018 09:55:55 +0200	[thread overview]
Message-ID: <87woxi2ktw.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87muyeg7t5.fsf@gmx.us> (rasmus@gmx.us's message of "Sat, 07 Apr 2018 21:01:10 +0200")

Hello,

Rasmus <rasmus@gmx.us> writes:

> These patches improve the block insertion mechanisms using both the
> keyboard binding and org-tempo.

Thank you. Some quick comments follow.

> Patch 6 changes the key binding of blocks to "C-c C-," as discussed in
> December 2017.  Let me know if this key is OK and if the old key should
> still be kept.

I don't think the old key-binding should be kept.

> +(defun org--mks-read-key (allowed-keys prompt)
> +  "Read a key and ensure it is a member of ALLOWED-KEYS.
> +
> +Tab, space and RET are treated equivalently."

Nitpick: No need for a blank line in the docstring.

Also: TAB, SPC and RET are ...

> +  (let* ((char (read-char-exclusive prompt))
> +	 (key (char-to-string
> +	       (cond ((memq char '(?\s ?\t ?\r)) ?\t)
> +		     (t char)))))

Suggestion:

  (key (pcase (read-char-exclusive prompt)
        ((or ?\s ?\t ?\r) ?\t)
        (char char)))

> +    (let ((menu-choice (org--insert-structure-template-mks)))
> +      (if (equal (nth 0 menu-choice) "\t")
> +	  (read-string "Structure type: ")
> +	(nth 1 menu-choice)))))

(pcase (org--insert-structure-template-mks)
  (`("\t" . ,_) (read-string "Structure type: "))
  (`(,_ ,choice . ,_) choice))
  
>    (let* ((region? (use-region-p))
>  	 (s (if region? (region-beginning) (point)))
>  	 (e (copy-marker (if region? (region-end) (point)) t))
> @@ -13568,7 +13652,7 @@ headlines matching this string."
>  	  ;; compile tags for current headline
>  	  (setq tags-list
>  		(if org-use-tag-inheritance
> -		    (apply 'append (mapcar 'cdr (reverse tags-alist)))
> +		    (apply #'append (mapcar 'cdr (reverse tags-alist)))

Nitpick: (mapcar #'cdr ...)

> +(defun org-tempo--keys ()
> +  (mapcar (lambda (pair) (format "<%s" (car pair)))
> +	  (append org-structure-template-alist
> +		  org-tempo-keywords-alist)))

Missing docstring.

> +(defun org-tempo--update-maybe ()
> +  "Test if new tags have been added."

I think you should clarify the docstring. It doesn't only test if new
tags have been added, but it also add templates.

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2018-04-08  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07 19:01 [patch] Improved block insertion Rasmus
2018-04-08  7:55 ` Nicolas Goaziou [this message]
2018-04-08 10:59   ` Rasmus
2018-04-08 13:22     ` Nicolas Goaziou

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87woxi2ktw.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /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/org-mode.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).