From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa Newsgroups: gmane.emacs.help Subject: Re: Abbrev for shorthand purposes Date: Wed, 10 Aug 2022 21:43:16 +0000 Message-ID: References: Reply-To: uzibalqa Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21836"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 10 23:44:13 2022 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 1oLtUp-0005WT-NW for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 10 Aug 2022 23:44:12 +0200 Original-Received: from localhost ([::1]:35718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLtUo-00038w-2s for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 10 Aug 2022 17:44:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLtUD-00038Z-He for help-gnu-emacs@gnu.org; Wed, 10 Aug 2022 17:43:33 -0400 Original-Received: from mail-40130.protonmail.ch ([185.70.40.130]:21853) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLtUA-0000vc-Er for help-gnu-emacs@gnu.org; Wed, 10 Aug 2022 17:43:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=qz6kixsiyzgopni2p3ieuub75m.protonmail; t=1660167800; x=1660427000; bh=NAn/sRYXuYpu13fuEdCVcB1L1HhGNeBi20+PEu2sanQ=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=PY65BB95Qa/j2c/wDwBmP57NShG1zbaEBoz2bB64k2WWELL3DpGWNUHNLRiqgNaUQ +RifD72MYS5J+qZ2cRxp1nVTSmTTlutSZhyRzYFZ9BYV5UtnD36CDqW4/HRVE2fbgr u4x/U5Iv/ASx5BOdrFrSmdC4bFZgOSAoe640EpqMPnFPS9pkCv9ZFt21rcjWzbUV6S Lw7WKoWV2ef7m/KWJvfF9oxBPFSsh0SqGp76wTf57HbEujlWGl57rHvN228uTBBT/r 5qF7pzehaApLyOkruHn0wtUsoTjRnENfX1XvO7dxhLU9cjbjXGQEqzplpOk3kLnXuB chpcL9q9zyisw== In-Reply-To: Feedback-ID: 52887082:user:proton Received-SPF: pass client-ip=185.70.40.130; envelope-from=uzibalqa@proton.me; helo=mail-40130.protonmail.ch 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, SPF_HELO_PASS=-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" Xref: news.gmane.io gmane.emacs.help:138788 Archived-At: ------- Original Message ------- On Wednesday, August 10th, 2022 at 8:30 PM, Jean Louis w= rote: > * uzibalqa via Users list for the GNU Emacs text editor help-gnu-emacs@gn= u.org [2022-08-05 08:34]: > > > Have been trying to use abbrev for shorthand purposes. I can go from te= xt to shorthand but not the other way round, because > > of the punctuation. Is there something I can do? Use of abbrev-mode als= o fails in situations when different the same abbreviation > > could expand to more than one word. > > > > ("wayward" "wa/") ("westward" "W/") > > ("adjustment" "ajs-") ("armament" "am-") > > ("basement" "bs-") ("casement" "ks-") > > ("enactment" "nak-") ("enjoyment" "njy-") > > ("enlargement" "nlj-") ("entertainment" "Ntn-") ("measurement" "mz/-") = ("movement" "mv-") > > ("recommend" "rk-") ("require" "rqi") ("separate" "sp;") > > ("silk" "slk") ("struck" "Sk") ("subject" "sj") > > > Why don't you use Emacs built-in interactive functions to add abbrevs? > > Purpose of abbrevs was not to use them programmatically, but to have > it handy to quickly add them while writing text. I am using them programmatically because I want to implement a specific scheme for short writing. > Abbrevs are not really made to abbreviate common words. Come one. That > is way too complicated. They are rather for more complex statements, > let us say to expand rms into Richard M. Stallman. You are absolutely right, but found abbrev the closest things I can do and = test the idea. I can take a normal word and make an abbreviated word. But I cannot perfor= m the reverse because the results include punctuation, which abbrev cannot process. For instance I can go from "sentimental" to "s--l" but not the reverse. ("sentimental" "s--l") I use company-mode to quickly complete the word "sentimental" whilst abbrev= mode would change "sentimental" to "s--l" once I hit space. > There are other good packages for that purpose to expand common words > of English language. > > How about {M-x dynamic-completion-mode RET}? I am thinking about completion (after trying abbrev). How can I go about i= t. What can I try? > From completion.el: > > ;; After you type a few characters, pressing the "complete" key inserts > ;; the rest of the word you are likely to type. > ;; Yes I can complete the word "sentimental", but am struggling on how the wor= d can then be changed to "s--l". > ;; This watches all the words that you type and remembers them. When > ;; typing a new word, pressing "complete" (meta-return) "completes" the > ;; word by inserting the most recently used word that begins with the > ;; same characters. If you press meta-return repeatedly, it cycles > ;; through all the words it knows about. > ;; > ;; If you like the completion then just continue typing, it is as if you > ;; entered the text by hand. If you want the inserted extra characters > ;; to go away, type control-w or delete. More options are described below= . > ;; > ;; The guesses are made in the order of the most recently "used". Typing > ;; in a word and then typing a separator character (such as a space) "use= s" > ;; the word. So does moving a cursor over the word. If no words are found= , > ;; it uses an extended version of the dabbrev style completion. > ;; > ;; You automatically save the completions you use to a file between > ;; sessions. > ;; > ;; Completion enables programmers to enter longer, more descriptive > ;; variable names while typing fewer keystrokes than they normally would. > ;; > ;; > ;; Full documentation > ;;--------------------- > ;; > ;; A "word" is any string containing characters with either word or symbo= l > ;; syntax. [E.G. Any alphanumeric string with hyphens, underscores, etc.] > ;; Unless you change the constants, you must type at least three characte= rs > ;; for the word to be recognized. Only words longer than 6 characters are > ;; saved. > ;; > ;; When you load this file, completion will be on. I suggest you use the > ;; compiled version (because it is noticeably faster). > ;; > ;; M-x completion-mode toggles whether or not new words are added to the > ;; database by changing the value of enable-completion. > ;; > ;; SAVING/LOADING COMPLETIONS > ;; Completions are automatically saved from one session to another > ;; (unless save-completions-flag or enable-completion is nil). > ;; Activating this minor-mode (calling completion-initialize) loads > ;; a completions database for a saved completions file > ;; (default: ~/.completions). When you exit, Emacs saves a copy of the > ;; completions that you often use. When you next start, Emacs loads in > ;; the saved completion file. > ;; > ;; The number of completions saved depends loosely on > ;; saved-completions-decay-factor. Completions that have never been > ;; inserted via "complete" are not saved. You are encouraged to experimen= t > ;; with different functions (see compute-completion-min-num-uses). > ;; > ;; Some completions are permanent and are always saved out. These > ;; completions have their num-uses slot set to T. Use > ;; add-permanent-completion to do this > ;; > ;; Completions are saved only if enable-completion is T. The number of ol= d > ;; versions kept of the saved completions file is controlled by > ;; completions-file-versions-kept. > ;; > ;; COMPLETE KEY OPTIONS > ;; The complete function takes a numeric arguments. > ;; control-u :: leave the point at the beginning of the completion rather > ;; than the middle. > ;; a number :: rotate through the possible completions by that amount > ;; `-' :: same as -1 (insert previous completion) > ;; > ;; HOW THE DATABASE IS MAINTAINED > ;; > > ;; > ;; UPDATING THE DATABASE MANUALLY > ;; m-x kill-completion > ;; kills the completion at point. > ;; m-x add-completion > ;; m-x add-permanent-completion > ;; > ;; UPDATING THE DATABASE FROM A SOURCE CODE FILE > ;; m-x add-completions-from-buffer > ;; Parses all the definition names from a C or LISP mode buffer and > ;; adds them to the completion database. > ;; > ;; m-x add-completions-from-lisp-file > ;; Parses all the definition names from a C or Lisp mode file and > ;; adds them to the completion database. > ;; > ;; UPDATING THE DATABASE FROM A TAGS TABLE > ;; m-x add-completions-from-tags-table > ;; Adds completions from the current tags-table-buffer. > ;; > ;; HOW A COMPLETION IS FOUND > ;; > > ;; > ;; STRING CASING > ;; Completion is string case independent if case-fold-search has its > ;; normal default of T. Also when the completion is inserted the case of = the > ;; entry is coerced appropriately. > ;; [E.G. APP --> APPROPRIATELY app --> appropriately > > ;; App --> Appropriately] > > ;; > ;; INITIALIZATION > ;; The form `(completion-initialize)' initializes the completion system b= y > ;; trying to load in the user's completions. After the first call, furthe= r > ;; calls have no effect so one should be careful not to put the form in a > ;; site's standard site-init file. > > > > > -- > Jean > > Take action in Free Software Foundation campaigns: > https://www.fsf.org/campaigns > > In support of Richard M. Stallman > https://stallmansupport.org/