2

Emacsでは、カーソル/ポイントが略語モード拡張で配置される場所を制御する方法はありますか?

ほら、こんな感じ?

("orgfootnote" "[fn:: %?]" nil 0)
4

3 に答える 3

4

Abbrev 自体はこの機能を提供していませんが、外部で行うための十分なフックを提供しています。例えば

(define-skeleton my-orgfootnote "Docstring." nil
  "fn::" _ "]")

そして、次のような略語を使用します

("orgfootnote" "" my-orgfootnote)
于 2013-03-13T18:19:29.203 に答える
2

組み込みの略語機能を意味する場合は、ここに問題に対する私の見解があります。この deafdvice を使用すると、文字列 @@ を含む略語がある場合、展開後、@@ が出現する展開されたテキストの位置にカーソルが配置されます。

 (defadvice expand-abbrev (after my-expand-abbrev activate)
   ;; if there was an expansion
   (if ad-return-value
       ;; start idle timer to ensure insertion of abbrev activator
       ;; character (e.g. space) is finished
       (run-with-idle-timer 0 nil
                            (lambda ()
                              ;; if there is the string "@@" in the
                              ;; expansion then move cursor there and
                              ;; delete the string
                              (let ((cursor "@@"))
                                (if (search-backward cursor last-abbrev-location t)
                                    (delete-char (length cursor))))))))
于 2013-03-13T15:31:47.570 に答える
1

テンプレートに記入する必要がある場合abbrevは、間違った機能です。私は強くお勧めしyasnippetます。 abbrevただし、頻繁なタイプミスを修正するのに非常に役立ちます。

于 2013-03-13T16:12:10.303 に答える