From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.help Subject: Re: Passing user selection to a command Date: Tue, 19 Mar 2024 13:32:27 +0100 Message-ID: <65f985dc.050a0220.20d40.9fcd@mx.google.com> References: <65f970a1.050a0220.3550.04dd@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8756"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 19 13:33:09 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1rmYeT-00020G-7s for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 19 Mar 2024 13:33:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmYdu-0003cL-T4; Tue, 19 Mar 2024 08:32:35 -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 1rmYds-0003bE-TK for help-gnu-emacs@gnu.org; Tue, 19 Mar 2024 08:32:32 -0400 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rmYdr-0007Qq-5F for help-gnu-emacs@gnu.org; Tue, 19 Mar 2024 08:32:32 -0400 Original-Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41413c99748so12966205e9.0 for ; Tue, 19 Mar 2024 05:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710851549; x=1711456349; darn=gnu.org; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:from:to:cc:subject:date:message-id:reply-to; bh=a8IXXTccx27GwQMhhJIzuIjA3zFw3KX8SWFObMIdMFA=; b=LVUgI61dDIaWnDAMqTtKKcAs6q4RQxsxLS2C8T+QjU3vCCDot4UmmD5kapW/vYF+NS AdT8MnNAiCT9wGnwkMHiRBrv5a8sfThZFg89qSNmkCTEsTvqulCTkRh3eZ2vEE6SAClo ILkWB4y4gCDUO/n+jdoilHxwSLYto83//kt1XH4kgCyIq4hh2+a83A+wizmm77zSLazF X4OHIkoxfIXVPl2EW5HAoVLhsZT/veaWW4FOxEF8vjNU2zeNoY2C0JX6uRuPGw8H8oAQ 8ocBxY7/sYt9Bu3I1HtktFI3VTLKryhx1Xh1gWM9tRueuAQIPo+rCAV96hgdc9yM9PyO bmLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710851549; x=1711456349; h=mime-version:date:references:in-reply-to:subject:cc:to:from :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a8IXXTccx27GwQMhhJIzuIjA3zFw3KX8SWFObMIdMFA=; b=EETrgahFS9Ss1M4J0rqLVUoaFWaPDkA48u2eB1jCFh3myBBvk2O+0O7nkp/WSC8EnC w/XnjP/09TFqeaKkStAsmCl52PHEoqClbd/3bIIx/LHne1AXw78eFoUM+J2B+diH/Soy BC/cUwLNyPGJpn1KY45/Wh96h94Ppmr+fh2GWbcONXzKnyX2TnrXjpbYHC9OqcEMwC3J ETGUFj+2fI+ezBsJLcn9TG6btWkKD4DxuuNKYoELyrUHtIi41VSfJSKqAZjbFZdCZPi8 FoA6ZRudjIdlpwwam1eh2kriY6/ksr4MjqsrM1IQL81qlHwZg8bl19pEQteXtlNzATX2 Yh0w== X-Gm-Message-State: AOJu0YyYxU+AQYeRDnL7q9sqp7U03k6JHejbzidDcijPFl2q+ASFZMHw 4O/eW0q3eiYCE92vkjVarE7+MX212794wd/zUDU0sb5HNt4+OZNc X-Google-Smtp-Source: AGHT+IHzd+ZQsX9N1jn8X5NgJMQmHhGBn/WEwO5WNBecXAO6uvUCNYFDuJsNk4l5yVILuTu0RJndpQ== X-Received: by 2002:a5d:618d:0:b0:33e:7380:df37 with SMTP id j13-20020a5d618d000000b0033e7380df37mr1832619wru.58.1710851548932; Tue, 19 Mar 2024 05:32:28 -0700 (PDT) Original-Received: from keynux ([2a01:e0a:505:3460:1c18:688d:ece4:372e]) by smtp.gmail.com with ESMTPSA id bw28-20020a0560001f9c00b003418364032asm2686843wrb.112.2024.03.19.05.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:32:28 -0700 (PDT) Original-Received: by keynux (sSMTP sendmail emulation); Tue, 19 Mar 2024 13:32:27 +0100 In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=brubar.cs@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146131 Archived-At: Heime writes: > Sent with Proton Mail secure email. > > On Tuesday, March 19th, 2024 at 11:01 PM, Bruno Barbier wrote: > >> Hi, >> >> Heime heimeborgia@protonmail.com writes: >> >> > How can I pass the user selection to 'activate-input-method' ? >> > >> > (defun glossus () >> > >> > (interactive >> > (list >> > (let ( (cseq '("italian-alt-postfix" "italian-keyboard" >> > "italian-postfix")) ) >> > (completing-read >> > " Glossus: " cseq nil t "italian-postfix")))) >> > >> > (setq ispell-local-dictionary "it_IT") >> > (activate-input-method "italian-postfix") ) >> >> >> IIUC, you could do this: >> >> (defun my-glossus (user-sel) ;; <==== var name here >> (interactive >> (list >> (let ( (cseq '("italian-alt-postfix" "italian-keyboard" >> "italian-postfix")) ) >> (completing-read >> " Glossus: " cseq nil t "italian-postfix")))) >> >> (setq ispell-local-dictionary "it_IT") >> (activate-input-method user-sel)) >> >> Bruno > > The documentation states that if some other input method is already active, > it is to be turned off first. How can I make the function do this ? The documentation of `activate-input-method' ? | If INPUT-METHOD is nil, deactivate any current input method. IIUB (if I understand better ;-) ), as I'm reading it, it says that `activate-input-method' will take care to turn previous methods OFF. You don't have to do anything. Bruno