all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: emacs-devel@gnu.org
Cc: Stefan Kangas <stefankangas@gmail.com>
Subject: Re: master 5892b4db8de 2/3: Convert dictionary-mode to define-derived-mode
Date: Wed, 16 Aug 2023 18:25:42 +0530	[thread overview]
Message-ID: <871qg3404x.fsf@gmail.com> (raw)
In-Reply-To: <20230812145313.C853CC038C2@vcs2.savannah.gnu.org> (Stefan Kangas's message of "Sat, 12 Aug 2023 10:53:13 -0400 (EDT)")

[சனி ஆகஸ்ட் 12, 2023] Stefan Kangas wrote:

> branch: master
> commit 5892b4db8de4694904f631dd86438926fb9d7ff1
> Author: Stefan Kangas <stefankangas@gmail.com>
> Commit: Stefan Kangas <stefankangas@gmail.com>
>
>     Convert dictionary-mode to define-derived-mode
>     
>     * lisp/net/dictionary.el (dictionary-instances): Delete.
>     (dictionary-mode): Use define-derived-mode.
>     (dictionary--count-mode-buffers): New function.
>     (dictionary-close): Use above new function.
 
> +(defun dictionary--count-mode-buffers ()
> +  "Return the number of buffers that "

The docstring is incomplete here.  :-(

> +  (seq-reduce #'+
> +              (mapcar
> +               (lambda (buf)
> +                 (with-current-buffer buf
> +                   (if (derived-mode-p 'dictionary-mode) 1 0)))
> +               (buffer-list))
> +              0))
> +

I believe the following function should be faster

    (defun dictionary--count-mode-buffers ()
      "Return the number of buffers that "
      (seq-reduce (lambda (count buf)
                    (if (provided-mode-derived-p (buffer-local-value 'major-mode buf)
                                                 'dictionary-mode)
                        (+ count 1)
                      count))
                  (buffer-list)
                  0))



       reply	other threads:[~2023-08-16 12:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <169185199333.11628.2162615922937919004@vcs2.savannah.gnu.org>
     [not found] ` <20230812145313.C853CC038C2@vcs2.savannah.gnu.org>
2023-08-16 12:55   ` Visuwesh [this message]
2023-08-16 19:45     ` master 5892b4db8de 2/3: Convert dictionary-mode to define-derived-mode Stefan Kangas
2023-08-16 22:33     ` Philip Kaludercic
2023-08-19 11:08       ` Stefan Kangas
2023-08-19 15:46         ` Philip Kaludercic
2023-08-17  9:15     ` Basil L. Contovounesios

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=871qg3404x.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=stefankangas@gmail.com \
    /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.