From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#73638: 31.0.50; doc-view: imenu index cannot be made for LaTeX PDFs Date: Sun, 06 Oct 2024 16:02:15 +0530 Message-ID: <87plodh68g.fsf@gmail.com> References: <87ploebyhc.fsf@gmail.com> <87ed4upbmf.fsf@gnu.org> <86plodvlcm.fsf@gnu.org> <87ttdphhir.fsf@gmail.com> <87jzel3aus.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8243"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 73638@debbugs.gnu.org To: Tassilo Horn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 06 12:34:12 2024 Return-path: Envelope-to: geb-bug-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 1sxOaZ-000207-34 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Oct 2024 12:34:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxOaN-0006iR-0X; Sun, 06 Oct 2024 06:33:59 -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 1sxOaK-0006gB-P9 for bug-gnu-emacs@gnu.org; Sun, 06 Oct 2024 06:33:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sxOaK-0001nP-9f for bug-gnu-emacs@gnu.org; Sun, 06 Oct 2024 06:33:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=DFFdMTeKDAQqTPs6J6+uI/4JpSoqRPC5AQ/PAqmsQ0k=; b=e7Q4u2UHhB5QSeMws6bSMzKphqGCUeHjQUbYCFVjcYu10wAg/GOdqji+llBvzS1y3KMu3bHeJQsZ5SCfkITUmU/SoeO36s1RpVAXPWPI4jcaN77vlM4q8vPohTYBkNxZRp7fY6GEkmTvzWoZxraj9xOSr09Itb6vPJP+q2eArQedg61tRxPk4aRbeMu3CuWHwUeZ2CXOcPECWz2+aE9qYidraWT8m16Gv+WhERvUTDPF911jEoHT18F+pvF+yKWTKI4LyEEvkWQYMwUvnSIEDnNamlV2kMoBU94eQ++u4zTEfsgxfEe5ZcHz08g5OtGZPp2x716+eszDMfnmXAK5Nw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sxOaP-00084K-P7 for bug-gnu-emacs@gnu.org; Sun, 06 Oct 2024 06:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Oct 2024 10:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73638 X-GNU-PR-Package: emacs Original-Received: via spool by 73638-submit@debbugs.gnu.org id=B73638.172821081330974 (code B ref 73638); Sun, 06 Oct 2024 10:34:01 +0000 Original-Received: (at 73638) by debbugs.gnu.org; 6 Oct 2024 10:33:33 +0000 Original-Received: from localhost ([127.0.0.1]:40223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxOZx-00083V-3W for submit@debbugs.gnu.org; Sun, 06 Oct 2024 06:33:33 -0400 Original-Received: from mail-pg1-f194.google.com ([209.85.215.194]:57647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxOZv-00083J-El for 73638@debbugs.gnu.org; Sun, 06 Oct 2024 06:33:32 -0400 Original-Received: by mail-pg1-f194.google.com with SMTP id 41be03b00d2f7-7e9ad969a4fso2089405a12.3 for <73638@debbugs.gnu.org>; Sun, 06 Oct 2024 03:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728210740; x=1728815540; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=DFFdMTeKDAQqTPs6J6+uI/4JpSoqRPC5AQ/PAqmsQ0k=; b=FeUqabuEHwUXBt2Vj1tleKSnsBcZoCMz4SaDqK2MaoJ/0BGo/X/4V/Su2WkvcMQQAp qSVk0Wv7qYWmGRURV3hhP2ifXxQfxCvPl1eQT/XPhSmKfvH468FpNJ/NY5pSeyD2v9SZ T9veiDr0+XW+eJvY3yD7O/3Jo/w3u0JzLczjI0cwJQ0ojnVt25/bLURLG1MWf693LgwK J2SRG3VnxtU5ZMSQRY2K/pWgH2SKW6CMUd8JEvfzAxqDjX7BzesK94t38DIGih3GxvMk wldXwJxkAWog/MD+Dy/i1qI813AUg/I15bxdmlQKt/V7szvsmp/ZnpvbsKv74gwe52i/ HDLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728210740; x=1728815540; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DFFdMTeKDAQqTPs6J6+uI/4JpSoqRPC5AQ/PAqmsQ0k=; b=IFTkynqfKlcA53xfCbRZEzdCFNahIkM/ccNnU1WZHXyoBaVzXpRutI4TiRdbZ631yQ GDh3bXdJLc54cXmSUyi4n532tKqy8VmgkIJzvN9YHXdliL9/4JKWNa+wc3A54FRSZZP8 kusPROe4FpXbGNnuu+YjKZJ5yfmQkPEkWdntCpiZL9smt93bqZtCwmowXVM6R1YAc114 laNRYuD83ZXSBEbTZBU8KiCICIbT9IR5nePQLDLR0cemqAxwb45f4XKOvBBmUCpsy3WH 43aBRh7nwN/tH1FUNYoa4Xlzbd9nK/L4xLLM2jh4MIoXjLXGF0KqUdp4SSma/jhGT5BR 4jOQ== X-Forwarded-Encrypted: i=1; AJvYcCVYtCq1XdqgAGFs34aZy4gxNjxW+OFCljc/3HnoBojWj/8ILqts7fUt+3rSsxMA/VXPK+bamg==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw6nyTNv4vLqlwFabFS7gNOHXYXZwQDxO+TPYFhCM5PMW+Kqh5v DqypKn0zWTncfMfMds9vh7GBsjDrzuZeu3uE1uywCBeODWHTxoSK X-Google-Smtp-Source: AGHT+IEU4Fzfrn2BdR6K5hLi4lH5ag0ebzT/tz6ECAyzB3Tw4RYA7KCZKxIfiQAggkQmbr/V4uiLVw== X-Received: by 2002:a05:6a21:9181:b0:1d2:bb49:536d with SMTP id adf61e73a8af0-1d6dfa3fe30mr14170103637.24.1728210739632; Sun, 06 Oct 2024 03:32:19 -0700 (PDT) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71df0cbdce1sm2608266b3a.2.2024.10.06.03.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 03:32:19 -0700 (PDT) In-Reply-To: <87jzel3aus.fsf@gnu.org> (Tassilo Horn's message of "Sun, 06 Oct 2024 10:16:11 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293075 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=85=E0=AE=95= =E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 06, 2024] Tassilo Ho= rn wrote: > Visuwesh writes: > >> When "mutool run" is called without any script argument, it opens a >> REPL. We would need to `process-send-string' to the REPL but the REPL >> reports syntax error when I try to do so. This is after trying to >> "minify" the JS script. Maybe I am doing something wrong. I've >> attached my test lisp at the end. > > I've tried doing the same and also get syntax errors. Same if I just > copy&paste the script with injected filename in the REPL on a terminal. > Both for the original script as well as for a minified version. First > I've thought that function definitions won't work at all but that's not > the case, e.g., I can enter this funcion at the REPL and it'll work: > >> function bar(i){if(i=3D=3D0) print("done"); else {print(i);bar(i-1);}} >> bar(10) > 10 > 9 > 8 > 7 > 6 > 5 > 4 > 3 > 2 > 1 > done > > > Ok, after experimenting a bit more and minimizing by hand, this version > of the script can be copy&pasted into the REPL and should probably also > work with process-send-string. Thanks for looking into this, and the solution! > var document =3D new Document.openDocument("/home/horn/sample.pdf", "appl= ication/pdf"); > var outline =3D document.loadOutline(); > if(!outline) quit(); > function pp(outl, level){print("((level . " + level + ")");print("(title = . " + repr(outl.title) + ")");print("(page . " + document.resolveLink(outl.= uri) + "))");if(outl.down){for(var i=3D0; i function run(){print("(");for(var i=3D0; i run(); > > It looks like the REPL wants function definitions on one single but > separate line. Sadly, that's not documented so I'm not sure how > reliable that formatting works across mutool versions or why the REPL > doesn't accept all valid JS. The only thing I can find in the man page > is that the =3D character at the beginning of a line has the special > meaning of "print the result of the following expression". As you expected, your minified version works fine when doing process-send-string. I do have not much experience working with async processes like this before, what do you think about the approach below? --=-=-= Content-Type: text/plain Content-Disposition: attachment (defvar test "var document = new Document.openDocument(\"%s\", \"application/pdf\"); var outline = document.loadOutline(); if(!outline) quit(); function pp(outl, level){print(\"((level . \" + level + \")\");print(\"(title . \" + repr(outl.title) + \")\");print(\"(page . \" + document.resolveLink(outl.uri) + \"))\");if(outl.down){for(var i=0; i