From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Refer to the directory of the currently being loaded elisp script from within the Emacs lisp file itself. Date: Fri, 11 Jun 2021 07:55:08 +0800 Message-ID: References: <871r99agku.fsf@telefonica.net> <87sg1p9198.fsf@telefonica.net> 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="18285"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: =?UTF-8?Q?=C3=93scar_Fuentes?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 11 01:55:53 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 1lrUWf-0004cp-5d for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 11 Jun 2021 01:55:53 +0200 Original-Received: from localhost ([::1]:41534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrUWd-0000HL-1b for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 10 Jun 2021 19:55:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrUWD-0000Gx-V1 for help-gnu-emacs@gnu.org; Thu, 10 Jun 2021 19:55:25 -0400 Original-Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]:33493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrUWA-000838-OG for help-gnu-emacs@gnu.org; Thu, 10 Jun 2021 19:55:25 -0400 Original-Received: by mail-lj1-x230.google.com with SMTP id r16so7325905ljc.0 for ; Thu, 10 Jun 2021 16:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=9KbLGXv1BauqKe29UisD56KxYNv3hBOo0Z72fAfAgsI=; b=qwN++Nz6bwkHkS2Cns+1qdHjF1BCou3x2meMjtogBpj0SEAI5nbAwpheZCVisPs0Il g9xTq3WL8l6k7YMuLD8/VTQlV2lGd3xwTldTbCUGml2W891gLztquvbyQrl8VQaHJG51 h8/w13DTvnKRJiH6D+hKTtVJzVDyn1rYwsxke7Z4MDEbT603+jYKPcnHUtMXGmb9UwZf Ht8CV9Z3Nih+mYChLAs379at6B9VPmBbuuvKAO0lqr9a1flf2UuMoz1YUX4sOQfisdwX 1DtdPjqC3WjsbU9VRmZ4FfGvmfGYjPIk7IREbKgwlMj3CsE56jZ8AcMmwdN3l97xr2Wq rutQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9KbLGXv1BauqKe29UisD56KxYNv3hBOo0Z72fAfAgsI=; b=mrvDTAsEIkHn3DmC6IU1HhGZsT13V9kyDPC7qy8kQPzUkMwpreB8mLNrDIKiQs53SG toh7CADVq7TsYFauosFJXhvU3G70aefrHmOeYDf+gq0//xqQEyaDqmdeCG5WOCB6YLbg jguBM6Ffwyhli/OLFUXYQ+CvxrKsuvIYwE0gbj3h6z2cz98HSsXplbAw2auCE6AWHWJ+ 64bARf1PIIQwDtocWIKz+HTQhtnums/BONNavD3A1Zwh9UUerfJk57oUweZ620xz+H7P lSWOw8i9emluwlPVq4ybQaZu29a1ec+X6sbKfwbETWoKogvDyzTROt52PG4IAfVDf8OT jtfg== X-Gm-Message-State: AOAM5335AlvvuIVrxDrZ1Cwcjko4hl2s4GnDjj1uyihDPVvtC+OkkOfk eYKl3b04rBSh2gaJLw2y+2PPTC4nOFQJJk0HSYs= X-Google-Smtp-Source: ABdhPJzmEv2b+6YFLE2Qe4w1SsyREYtUrvLio+trmwkUHGTO36UoiW5kcQ9/FUvcCq9cMTlw6wr3kO45DnC81jHSzl4= X-Received: by 2002:a2e:8e7c:: with SMTP id t28mr787136ljk.246.1623369320508; Thu, 10 Jun 2021 16:55:20 -0700 (PDT) In-Reply-To: <87sg1p9198.fsf@telefonica.net> Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=hongyi.zhao@gmail.com; helo=mail-lj1-x230.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:130733 Archived-At: On Thu, Jun 10, 2021 at 11:40 PM =C3=93scar Fuentes wrote: > > Hongyi Zhao writes: > > >> BTW, the correct method for concatenating a directory and a file name = is > >> > >> (load-file > >> (concat > >> (file-name-as-directory (file-name-directory load-file-name)) > >> "auth.el.gpg")) > > > > I tried you above code, it still doesn't work with the following info: > > > > file-name-as-directory: Wrong type argument: stringp, nil [2 times] > > Mark set > > load-file-name is defined while the file is being loaded, after that it > is nil. So if you tried with `C-x C-e' or some other interactive command > it wont work. > > Once the code above is in the correct file, save it, start Emacs and > report back what happens. See my current usage on according to the instructions here. After I start Emacs and tried with `M-x screenlatex RET', I will see the following info in *Messages* buffer: expand-file-name: Wrong type argument: stringp, nil The expected behavior is that with the above command, the encrypted token file, i.e., "auth.el.gpg" will be loaded and the decrypted text will be inserted in the buffer. Finally, the screen capture action will be triggered, as happens when I use the following absolute path shown at : (load-file (expand-file-name "~/Public/repo/github.com/hongyi-zhao/screen2latex.el.git/auth.el.gpg")) Regards --=20 Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering NO. 552 North Gangtie Road, Xingtai, China