From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: dict Date: Thu, 18 May 2023 13:59:25 +0300 Message-ID: <837ct5x5v6.fsf@gnu.org> References: <834joj55pt.fsf@gnu.org> <87ednnvtt6.fsf@posteo.net> <875y8ywwko.fsf@posteo.net> <83zg69br5f.fsf@gnu.org> <83ednj9sw2.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16152"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philipk@posteo.net, emacs-devel@gnu.org To: Eshel Yaron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 18 13:00:07 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pzbMd-0003yW-Qc for ged-emacs-devel@m.gmane-mx.org; Thu, 18 May 2023 13:00:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzbLr-0007Ud-2c; Thu, 18 May 2023 06:59:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzbLn-0007UL-E0 for emacs-devel@gnu.org; Thu, 18 May 2023 06:59:15 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzbLm-0003bc-Hj; Thu, 18 May 2023 06:59:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SxXcOh/Dnp0jhmainctXy2ioM29UDa1jLDBQOfrZ6i0=; b=cP11eas9PVy9 LyKIc5owYg/boSroLibPGZti4NGMP5xQ/WA0DhCnzukwHY30/4+tjzx3YtXhyxDIdS9pXBa4xx0hy n2H+0s2lOmI/LhD+x690+dbjjgN5eBXsbHH5oLsray+6KOsjip0OXBaOyICr1PqBFL1gBMeIBkfxt 7+I5v4Itb8z0K886CX13VS8zZRl4jRLtVSqQF/BG6/lonRQw0+6l4UvN4jKw2ZDwqoZKjkyqlYxJF 9VF9zSo8/axpTFSPZj+HLVmtH7wmnG++bKurtnmCdGt0FetsVGj4Qq85SHiEapzi/ywr9tjBRLfxg taVqXJftl7YIw7/xl3LYRw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzbLk-0003DU-H4; Thu, 18 May 2023 06:59:14 -0400 In-Reply-To: (message from Eshel Yaron on Mon, 15 May 2023 21:50:57 +0300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306170 Archived-At: > From: Eshel Yaron > Cc: philipk@posteo.net, emacs-devel@gnu.org > Date: Mon, 15 May 2023 21:50:57 +0300 > > >> In short, we need two things: a way to obtain a word's definition and a > >> way to obtain dictionary matches given some input (for completion). > >> dictionary.el does these things already, but in way that's too coupled > >> with its user interface to admit reuse for my purposes. So the question > >> is whether to add the needed stuff from Dict to dictionary.el and accept > >> some code duplication, or try to refactor the parts of dictionary.el > >> that communicate with the dictionary server to provide a cleaner API. > > > > I'd say try the latter if it's reasonably easy; otherwise try the > > former. > > Alright, I'm attaching a patch that extends dictionary.el with new user > options that modify the behavior of `dictionary-search`. Looks reasonable, thanks. > With this patch, `dictionary-search` behaves like my > `dict-describe-word` after applying the following customizations: > > --8<---------------cut here---------------start------------->8--- > (setq dictionary-read-dictionary-function > #'dictionary-completing-read-dictionary) > (setq dictionary-read-word-function > #'dictionary-completing-read-word) > (setq dictionary-display-definition-function > #'dictionary-display-definition-in-help-buffer) > --8<---------------cut here---------------end--------------->8--- This looks excessive. How about adding yet another defcustom, with a :set function, which will make all these adjustments for users who want the words displayed in *Help*?