From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: excalamus--- via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Converting string to symbol Date: Sun, 3 Jan 2021 21:54:32 +0100 (CET) Message-ID: Reply-To: excalamus@tutanota.com 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="38522"; mail-complaints-to="usenet@ciao.gmane.io" To: Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 03 22:20:55 2021 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 1kwAo1-0009t5-4V for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 03 Jan 2021 22:20:53 +0100 Original-Received: from localhost ([::1]:36252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwAo0-0004Rh-5R for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 03 Jan 2021 16:20:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwAOg-0007kJ-0P for help-gnu-emacs@gnu.org; Sun, 03 Jan 2021 15:54:42 -0500 Original-Received: from w1.tutanota.de ([81.3.6.162]:37402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwAOa-0006tz-Rb for help-gnu-emacs@gnu.org; Sun, 03 Jan 2021 15:54:41 -0500 Original-Received: from w3.tutanota.de (unknown [192.168.1.164]) by w1.tutanota.de (Postfix) with ESMTP id 12B50FA01AD for ; Sun, 3 Jan 2021 20:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1609707272; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=0wK6z7kCzYRCbyD3eF933VXmNMClHX90pUsmEobuczg=; b=Cqk/9e7zMFeYzSiVLUgrZv+hBouyUwB2D26dnD/hZ5d/L95WNGTYb3dzF7FwKxRJ hSk41ui9w8v68Bc8HKdtM4M4CD8T4PpLgORdkVkSQBFDOYAzsaN9demrSpWx7kvmZQ0 sKLQ5tr9tr/a++KJsDSQmnX/aqrlp2CHYlsJkctBCHvhnI3KkHaP9h2I037zJTzq5Ph kpO6tiq9CgZ+d4SUi/waaX4D+07YNyvDlBO1YZAeYbFqgofZdee1XBtOEhyS4teQ/7w zldwVInaoQH3Z8tvAFh7MGYvzlbGdhDBWKK84t9AWP++nI0ib32GfuGIeakUpeeY0U8 oF9/QEVZ8Q== Received-SPF: pass client-ip=81.3.6.162; envelope-from=excalamus@tutanota.com; helo=w1.tutanota.de 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, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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:126980 Archived-At: Hi,=20 I want to define a global abbrev with case-fixed property t.=C2=A0 I want t= his abbrev to appear in the define-abbrev-table definition created by write= -abbrev-file. To my knowledge, there is no native option to do this.=C2=A0 So, I have def= ined a function which wraps define-abbrev and reads in the table, abbrev na= me, and expansion from the user. (defun my-add-case-fixed-abbrev (name expansion &optional table) =C2=A0 "Add abbrev with case-fixed t property." =C2=A0 (interactive =C2=A0=C2=A0 (let ((table (intern-soft (completing-read =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Abbrev table (globa= l-abbrev-table): " =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 abbrev-table-name-li= st nil t nil nil "global-abbrev-table" ))) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (name (read-string "Abbrev= name: ")) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (expansion (read-string "E= xpansion: "))) =C2=A0=C2=A0=C2=A0=C2=A0 (list name expansion table))) =C2=A0 (let ((table (or table global-abbrev-table))) =C2=A0=C2=A0=C2=A0 (define-abbrev table name expansion nil :case-fixed t))) Since completing-read returns a string, I convert the string representing t= he abbrev table to the corresponding symbol using intern-soft.=C2=A0=20 However, this causes the error "Wrong-type-argument vectorp global-abbrev-t= able" when calling explicitly or interactively. (my-add-case-fixed-abbrev "my-abbrev" "my-expansion" "global-abbrev-table"= ) ;; causes error The error doesn't appear when the default argument is used (my-add-case-fixed-abbrev "my-abbrev" "my-expansion")=C2=A0 ;; uses default= arg, no error I can see that (eq 'global-abbrev-table (intern-soft "global-abbrev-table")= ) returns t.=C2=A0 How does the symbol created by intern-soft differ from t= he symbol 'global-abbrev-table' used as the default within let? I can see that (vectorp (intern-soft "global-abbrev-table")) is nil, so fai= r enough, table is not a vector.=C2=A0=20 If I convert table to a vector using =C2=A0=C2=A0 (let ((table (vector (intern-soft (completing-read =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Abbrev table (globa= l-abbrev-table): " =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 abbrev-table-name-li= st nil t nil nil "global-abbrev-table" )))) I get the error "Wrong type argument: number-or-marker-p, nil". I have run each of these with debug-on-error set, but I'm not sure how to i= nterpret the error message. =C2=A0=20 Any hint on what's going on here?