From mboxrd@z Thu Jan 1 00:00:00 1970 From: "numbchild@gmail.com" Subject: Re: [patch] structure snippet completions Date: Sat, 9 Dec 2017 21:42:46 +0800 Message-ID: References: <87mv2ya2ep.fsf@pank.eu> <87d13u6ws3.fsf@nicolasgoaziou.fr> <87vahl8oel.fsf@gmx.us> <878tegapfy.fsf@nicolasgoaziou.fr> <87h8t23yag.fsf@gmx.us> <0DE4E68E-7A0F-4602-9BB1-2DA7BB2D5DD7@ucsd.edu> <87wp1w3oi7.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c11e888ca8b36055fe87b49" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNfPU-0004Yj-5F for emacs-orgmode@gnu.org; Sat, 09 Dec 2017 08:43:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNfPS-00033D-JU for emacs-orgmode@gnu.org; Sat, 09 Dec 2017 08:43:20 -0500 Received: from mail-ot0-x235.google.com ([2607:f8b0:4003:c0f::235]:33765) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eNfPS-000330-D0 for emacs-orgmode@gnu.org; Sat, 09 Dec 2017 08:43:18 -0500 Received: by mail-ot0-x235.google.com with SMTP id h9so11349831oti.0 for ; Sat, 09 Dec 2017 05:43:18 -0800 (PST) In-Reply-To: <87wp1w3oi7.fsf@gmx.us> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Rasmus Cc: Org-mode --94eb2c11e888ca8b36055fe87b49 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable error report when I `(require 'org-tempo)` Debugger entered--Lisp error: (error "Format specifier doesn=E2=80=99t matc= h argument type") format("<%c" "Q") (closure (t) (pair) (format "<%c" (car pair)))(("Q" "#+BEGIN_SRC sql-mode ?\n\n#+END_SRC" "#+BEGIN_SRC sql-mode ?\n\n#+END_SRC")) mapcar((closure (t) (pair) (format "<%c" (car pair))) (("Q" "#+BEGIN_SRC sql-mode ?\n\n#+END_SRC" "#+BEGIN_SRC sql-mode ?\n\n#+END_SRC") ("n" "#+BEGIN_NOTES\n?\n#+END_NOTES") (116 . "translate") (97 . "export ascii") (99 . "center") (67 . "comment") (101 . "example") (69 . "export") (104 . "export html") (108 . "export latex") (113 . "quote") (115 . "src") (118 . "verse") (76 . "latex") (72 . "html") (65 . "ascii") (105 . "index"))) (let ((keys (mapcar (function (lambda (pair) (format "<%c" (car pair)))) (append org-structure-template-alist org-tempo-keywords-alist)))) (if (> (length keys) (length (delete-dups keys))) (progn (warn "Duplicated keys in `org-structure-template-alist' and `org-tempo-keywords-alist'"))) (mapc (function (lambda (key) (if (assoc-string key org-tempo-tags) (setq org-tempo-tags (delete (assoc-string key org-tempo-tags) org-tempo-tags))))) keys) (mapc (function org-tempo-add-block) org-structure-template-alist) (mapc (function org-tempo-add-keyword) org-tempo-keywords-alist)) org-tempo-add-templates() org-tempo-setup() (progn (org-tempo-setup)) (if (eq major-mode 'org-mode) (progn (org-tempo-setup))) eval-buffer(# nil "/home/stardiviner/Code/Emacs/org-mode/lisp/org-tempo.el" nil t) ; Reading at buffer position 5019 load-with-code-conversion(#1=3D"/home/stardiviner/Code/Emacs/org-mode/lisp/= org-tempo.el" #1# nil t) require(org-tempo) [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Sat, Dec 9, 2017 at 5:20 AM, Rasmus wrote: > "Berry, Charles" writes: > > >> On Dec 7, 2017, at 3:37 PM, Rasmus wrote: > >> > >> I have also pushed the code. " >> enabled by requiring org-tempo. > >> > > > > Thanks. I was in a deep funk without " now. > > I am happy that I am able to help you for once! > > >> Let me know about any issues. > >> > > > > Maybe make `tempo-match-finder' be "^ *\\(<[[:word:]]+\\)" so it will > > match things like " > the user customize it. > > At the moment snippets with more than one character isn=E2=80=99t support= ed. Note > that the car of org-structure-template-alist elements is now a character. > "Snippet-strings" (like "la") will be re-added soon cf. the email from > Eric earlier on in this thread. > > > > A minor gotcha: if you `(require 'org-tempo)' after an org buffer has > > been created you will need to (org-mode-restart) the buffer to enable > > completions. I got stuck trying to add custom templates until I > > realized this. > > It shouldn=E2=80=99t do that since this is near the bottom of org-tempo: > > (when (eq major-mode 'org-mode) (org-tempo-setup)) > > On my system it works in the first buffer where I require org-tempo, even > without reloading. > > Which version of Emacs are you using? > > Rasmus > > -- > A clever person solves a problem. A wise person avoids it > > > --94eb2c11e888ca8b36055fe87b49 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
error report when I `(require 'org-tempo)`

Debugger entered--Lisp error: (error "Format specifier doesn=E2=80= =99t match argument type")
=C2=A0 format("<%c" "Q= ")
=C2=A0 (closure (t) (pair) (format "<%c" (car pair)= ))(("Q" "#+BEGIN_SRC sql-mode ?\n\n#+END_SRC" "#+B= EGIN_SRC sql-mode ?\n\n#+END_SRC"))
=C2=A0 mapcar((closure (t) (pai= r) (format "<%c" (car pair))) (("Q" "#+BEGIN_SR= C sql-mode ?\n\n#+END_SRC" "#+BEGIN_SRC sql-mode ?\n\n#+END_SRC&q= uot;) ("n" "#+BEGIN_NOTES\n?\n#+END_NOTES") (116 . &quo= t;translate") (97 . "export ascii") (99 . "center"= ) (67 . "comment") (101 . "example") (69 . "export= ") (104 . "export html") (108 . "export latex") (1= 13 . "quote") (115 . "src") (118 . "verse") (= 76 . "latex") (72 . "html") (65 . "ascii") (1= 05 . "index")))
=C2=A0 (let ((keys (mapcar (function (lambda (= pair) (format "<%c" (car pair)))) (append org-structure-templa= te-alist org-tempo-keywords-alist)))) (if (> (length keys) (length (dele= te-dups keys))) (progn (warn "Duplicated keys in `org-structure-templa= te-alist' and `org-tempo-keywords-alist'"))) (mapc (function (= lambda (key) (if (assoc-string key org-tempo-tags) (setq org-tempo-tags (de= lete (assoc-string key org-tempo-tags) org-tempo-tags))))) keys) (mapc (fun= ction org-tempo-add-block) org-structure-template-alist) (mapc (function or= g-tempo-add-keyword) org-tempo-keywords-alist))
=C2=A0 org-tempo-add-tem= plates()
=C2=A0 org-tempo-setup()
=C2=A0 (progn (org-tempo-setup))=C2=A0 (if (eq major-mode 'org-mode) (progn (org-tempo-setup)))
=C2= =A0 eval-buffer(#<buffer=C2=A0 *load*> nil "/home/stardiviner/Co= de/Emacs/org-mode/lisp/org-tempo.el" nil t)=C2=A0 ; Reading at buffer = position 5019
=C2=A0 load-with-code-conversion(#1=3D"/home/stardivi= ner/Code/Emacs/org-mode/lisp/org-tempo.el" #1# nil t)
=C2=A0 requir= e(org-tempo)


[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!>=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): stardiviner =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchild
Key finge= rprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog:= http://stardiv= iner.github.io/

On Sat, Dec 9, 2017 at 5:20 AM, Rasmus <rasmus@= gmx.us> wrote:
"Berry, Charles" <cc= berry@ucsd.edu> writes:

>> On Dec 7, 2017, at 3:37 PM, Rasmus <rasmus@gmx.us> wrote:
>>
>> I have also pushed the code.=C2=A0 "<s"-like snippet = expansion should be
>> enabled by requiring org-tempo.
>>
>
> Thanks. I was in a deep funk without "<s" and friends.=C2= =A0 Feeling better now.

I am happy that I am able to help you for once!

>> Let me know about any issues.
>>
>
> Maybe make `tempo-match-finder' be "^ *\\(<[[:word:]]+\\)&= quot; so it will
> match things like "<la" when I want a latex align environ= ment.=C2=A0 Or let
> the user customize it.

At the moment snippets with more than one character isn=E2=80=99t su= pported.=C2=A0 Note
that the car of org-structure-template-alist elements is now a character. "Snippet-strings" (like "la") will be re-added soon cf.= the email from
Eric earlier on in this thread.


> A minor gotcha: if you `(require 'org-tempo)' after an org buf= fer has
> been created you will need to (org-mode-restart) the buffer to enable<= br> > completions.=C2=A0 I got stuck trying to add custom templates until I<= br> > realized this.

It shouldn=E2=80=99t do that since this is near the bottom of org-te= mpo:

=C2=A0 =C2=A0 (when (eq major-mode 'org-mode) (org-tempo-setup))

On my system it works in the first buffer where I require org-tempo, even without reloading.

Which version of Emacs are you using?

Rasmus

--
A clever person solves a problem. A wise person avoids it



--94eb2c11e888ca8b36055fe87b49--