From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id IMmNLoOqaGLXKAAAbAwnHQ (envelope-from ) for ; Wed, 27 Apr 2022 04:29:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iLyvLoOqaGKINAAA9RJhRA (envelope-from ) for ; Wed, 27 Apr 2022 04:29:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1EAFF3F7D3 for ; Wed, 27 Apr 2022 04:29:23 +0200 (CEST) Received: from localhost ([::1]:45358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njXQf-0000R0-CX for larch@yhetil.org; Tue, 26 Apr 2022 22:29:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njXPL-0000MG-Kc for emacs-orgmode@gnu.org; Tue, 26 Apr 2022 22:27:59 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]:45854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njXPK-0005sE-0S for emacs-orgmode@gnu.org; Tue, 26 Apr 2022 22:27:59 -0400 Received: by mail-oi1-x234.google.com with SMTP id 12so590398oix.12 for ; Tue, 26 Apr 2022 19:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vu9oSPqcESqI0cYeENve4Ntlp5IYLrqdEvhUR6aO7I8=; b=NqUyBVvCv39PjwQLrrcWBCDrMYyatedqn+gF86rIScGKrU96P9uV4yAbAzOo0NiYLO 5W7C9xqPRv3yZobS0CKOO/7y0soR0DPGIOb8Olv2kPzlPXSfKF8ALzpR9pDmehotxaOM e0jGaUn3zX2EOKS71ZiHtzSeTN34O86XNbOQWSIZWEK1FBmKhjnMSH/enkZJrgBOJ1BH liCWpodj+OB8K7pQ5Bgwn1maCoghTL4INAjqsKlN+QQ/23DwAZ+N1XYR/eoxd4A5GBF2 U+TRchTpo3Ofx5iRCqXeY+bayDz0HJcboJkFmjaxtToBCGGE5M/397zFsKUB7BUf8J4b E/HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vu9oSPqcESqI0cYeENve4Ntlp5IYLrqdEvhUR6aO7I8=; b=wyWjWHOEqqSOSviNtqksHK10PVev8xyBTKYL9aXj2ncgpw+TDdo1k7w+W8oG872sZt 6tXvr77g51nWO41Y5m815IrLwyCeaLxevZhEdXae/E/BdKrZlp8qVOQ5cdF5H+X3HNOU yi+s/+DSGQZZyPcSN4Lq/h4mX+wigE9diWkoB5qehYE65v/7XpLZi2SM/prdQ48uIcLM Iet8jLQno/FmXLZC0lIcZjF8wSxlJvL+Uzl+WMgVGWdSH/OKhUiS8jy3o2RCricfXghI s5PxL0dr33NqlYFJO1l/oJM7sQUysB9pqF2Iz+fmRPEGcc9UxV5R9Dileq0cVrLhSWct q+3Q== X-Gm-Message-State: AOAM532iyRlUDrIv1KrFxh/7M75rnHCVnZ8rN5f7aHd58zo10B/d8q23 b0Q62LuRAlHFta8RmY9jQ9hSccoUxjb7St2GjkM= X-Google-Smtp-Source: ABdhPJz3seXdVDCWTpOem3+YON2fMJ2Q2TEnhDwUomt61Sr60D/KZyBAfeg524o+jDW3QoqMVw1x2Ss9lDlIh7ZDgbk= X-Received: by 2002:a05:6808:120a:b0:322:3447:2d7a with SMTP id a10-20020a056808120a00b0032234472d7amr16030587oil.40.1651026476327; Tue, 26 Apr 2022 19:27:56 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6359:d24:b0:99:7b9:e3b1 with HTTP; Tue, 26 Apr 2022 19:27:55 -0700 (PDT) In-Reply-To: References: From: Samuel Wales Date: Tue, 26 Apr 2022 19:27:55 -0700 Message-ID: Subject: Re: Automatically use Heading Content as EXPORT_FILE_NAME? To: Tim Visher Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::234; envelope-from=samologist@gmail.com; helo=mail-oi1-x234.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emacs Org Mode mailing list Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651026563; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vu9oSPqcESqI0cYeENve4Ntlp5IYLrqdEvhUR6aO7I8=; b=Rmt052MR/83rwwES9qQpJaVKmncrpMEDlJN3dho85gMOAjkZiEnhPAogfW+uDltb/U87wq FG+8rbrRd/vfzXYOLA6Jl6aKKGIrIsJslN5EqjUa+Lch6lPxcB3OpepMqutiltemMDljbM 0rM+KwjkjyaCHNtK1K49dVEyEPOyYtuL2QRWJ/0k5XRpmcVaNEFuiH4VOKoPboc+gXFc+Q stAXmJm6IsMTsiJMPvGo0Az3E4r9X848EAvOmysYY9ql/w9z0TlzcLi1JlrYJc35RkrXRj FgiZm6B5La+fxq6WK7vx6/bcaC++QMf90Jl07p54BoNbEjqzbRmo01PmlRaFgA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651026563; a=rsa-sha256; cv=none; b=c4zguvqlPkKWfVYNmNn9bWNa7dAo4IfNEZeCxjepIbYOCOEX0Pv9A4AAVcDgVnOqcZaxK7 o5GTQW4coQw5WfUk0DBM7tJ+h148W4UuF7KCVjE2TF7jVZATYPfJSpimiX4R+RxR3AuFxN A5MxsbCZ2byOj8nH6clRFL46p1aVpKkTwg+jNqDcFMFtiA2HjJmZMjtPSyOtGYmG5HiMBx eyA//b2RwqwyinpXR6Ib8ViRMnrCIRsVu0yoTzHiEPLbOC4yfYknO2FxxJEBrtWmif6r3U lmUlg9/O1uy+T9NgLfbvwXGFvjKd8mEV76lx54x/O7MwonNqol7xek8ByzZLAA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NqUyBVvC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NqUyBVvC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1EAFF3F7D3 X-Spam-Score: -3.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: hIKXPdnhhwVT fwiw, what i do is export to a buffer, then write to a file whose name is derived from the header. (alpha-make-valid-path (with-current-buffer org-buffer (org-get-heading 'no-tags 'no-todo))) (defun alpha-make-valid-path (s) "Make a string into a filesystem path." ;; see files.el for this and tramp (subst-char-in-string ?/ ?! (replace-regexp-in-string "!" "!!" s))) i think it might have some issues with long headers and some basename limit on linux. you seem to truncate for that. On 4/26/22, Tim Visher wrote: > On Tue, Apr 26, 2022 at 11:54 AM Tim Visher wrote: > >> I'm currently going to hack around it I think by simply making a function >> that updates the EXPORT_FILE_NAME property with the current heading text. >> > > That's something like > > ``` > (defun timvisher-org-set-export_file_name-property-to-heading-text > () > (interactive) > (org-set-property > "EXPORT_FILE_NAME" > (let ((stripped-heading > (replace-regexp-in-string > "[^-A-Za-z0-9_.~#+ ]" > "" > (substring-no-properties (org-get-heading t t t t))))) > (substring-no-properties > stripped-heading > 0 > (min (length stripped-heading) 250))))) > ``` > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com