[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-contrib 89931aece2 08/10: lisp/ox-bibtex.el: Convert o
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/org-contrib 89931aece2 08/10: lisp/ox-bibtex.el: Convert obsolete `defadvice' to `define-advice' |
|
Date: |
Wed, 17 Jan 2024 07:01:02 -0500 (EST) |
branch: elpa/org-contrib
commit 89931aece2f2ef9159041c9eb93305ec1067069c
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
lisp/ox-bibtex.el: Convert obsolete `defadvice' to `define-advice'
* lisp/ox-bibtex.el:
(org-latex-keyword):
(org-html-keyword):
(org-html-latex-fragment):
(org-ascii-keyword):
(org-ascii-latex-fragment): Convert to `define-advice'.
---
lisp/ox-bibtex.el | 93 +++++++++++++++++++++++--------------------------------
1 file changed, 38 insertions(+), 55 deletions(-)
diff --git a/lisp/ox-bibtex.el b/lisp/ox-bibtex.el
index a5eddea59a..27f73116f6 100644
--- a/lisp/ox-bibtex.el
+++ b/lisp/ox-bibtex.el
@@ -344,21 +344,16 @@ the HTML and ASCII backends."
;;; LaTeX Part
-(defadvice org-latex-keyword (around bibtex-keyword)
+(define-advice org-latex-keyword (:around (fun keyword contents info)
bibtex-keyword)
"Translate \"BIBLIOGRAPHY\" keywords into LaTeX syntax.
Fallback to `latex' back-end for other keywords."
- (let ((keyword (ad-get-arg 0)))
- (if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
- ad-do-it
- (let ((file (org-bibtex-get-file keyword))
- (style (org-not-nil (org-bibtex-get-style keyword))))
- (setq ad-return-value
- (when file
- (concat (and style (format "\\bibliographystyle{%s}\n" style))
- (format "\\bibliography{%s}" file))))))))
-
-(ad-activate 'org-latex-keyword)
-
+ (if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
+ (funcall fun keyword contents info)
+ (let ((file (org-bibtex-get-file keyword))
+ (style (org-not-nil (org-bibtex-get-style keyword))))
+ (when file
+ (concat (and style (format "\\bibliographystyle{%s}\n" style))
+ (format "\\bibliography{%s}" file))))))
;;; HTML Part
@@ -369,61 +364,49 @@ Fallback to `latex' back-end for other keywords."
;;;; Advices
-(defadvice org-html-keyword (around bibtex-keyword)
+(define-advice org-html-keyword (:around (fun keyword contents info)
bibtex-keyword)
"Translate \"BIBLIOGRAPHY\" keywords into HTML syntax.
Fallback to `html' back-end for other keywords."
- (let ((keyword (ad-get-arg 0)))
- (if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
- ad-do-it
- (setq ad-return-value
- (cdr (assq keyword org-bibtex-html-keywords-alist))))))
+ (if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
+ (funcall fun keyword contents info)
+ (cdr (assq keyword org-bibtex-html-keywords-alist))))
-(defadvice org-html-latex-fragment (around bibtex-citation)
+(define-advice org-html-latex-fragment (:around (fun fragment contents info)
bibtex-citation)
"Translate \"\\cite\" LaTeX fragments into HTML syntax.
Fallback to `html' back-end for other keywords."
- (let ((fragment (ad-get-arg 0)))
- (if (not (org-bibtex-citation-p fragment)) ad-do-it
- (setq ad-return-value
- (format "[%s]"
- (mapconcat
- (lambda (key)
- (format "<a href=\"#%s\">%s</a>"
- key
- (or (cdr (assoc key
org-bibtex-html-entries-alist))
- key)))
- (org-split-string
- (org-bibtex-get-citation-key fragment) ",") ","))))))
-
-(ad-activate 'org-html-keyword)
-(ad-activate 'org-html-latex-fragment)
+ (if (not (org-bibtex-citation-p fragment))
+ (funcall fun fragment contents info)
+ (format "[%s]"
+ (mapconcat
+ (lambda (key)
+ (format "<a href=\"#%s\">%s</a>"
+ key
+ (or (cdr (assoc key org-bibtex-html-entries-alist))
+ key)))
+ (org-split-string
+ (org-bibtex-get-citation-key fragment) ",") ","))))
;;; Ascii Part
-(defadvice org-ascii-keyword (around bibtex-keyword)
+(define-advice org-ascii-keyword (:around (fun keyword contents info)
bibtex-keyword)
"Translate \"BIBLIOGRAPHY\" keywords into ascii syntax.
Fallback to `ascii' back-end for other keywords."
- (let ((keyword (ad-get-arg 0)))
- (if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
- ad-do-it
- (setq ad-return-value
- (cdr (assq keyword org-bibtex-html-keywords-alist))))))
+ (if (not (equal (org-element-property :key keyword) "BIBLIOGRAPHY"))
+ (funcall fun keyword contents info)
+ (cdr (assq keyword org-bibtex-html-keywords-alist))))
-(defadvice org-ascii-latex-fragment (around bibtex-citation)
+(define-advice org-ascii-latex-fragment (:around (fun fragment contents info)
bibtex-citation)
"Translate \"\\cite\" LaTeX fragments into ascii syntax.
Fallback to `ascii' back-end for other keywords."
- (let ((fragment (ad-get-arg 0)))
- (if (not (org-bibtex-citation-p fragment)) ad-do-it
- (setq ad-return-value
- (format "[%s]"
- (mapconcat
- (lambda (key)
- (or (cdr (assoc key org-bibtex-html-entries-alist))
- key))
- (org-split-string
- (org-bibtex-get-citation-key fragment) ",") ","))))))
-
-(ad-activate 'org-ascii-keyword)
-(ad-activate 'org-ascii-latex-fragment)
+ (if (not (org-bibtex-citation-p fragment))
+ (funcall fun fragment contents info)
+ (format "[%s]"
+ (mapconcat
+ (lambda (key)
+ (or (cdr (assoc key org-bibtex-html-entries-alist))
+ key))
+ (org-split-string
+ (org-bibtex-get-citation-key fragment) ",") ","))))
(provide 'ox-bibtex)
- [nongnu] elpa/org-contrib updated (8fbaceb247 -> 8d07b9491a), ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 718ba60fe0 01/10: lisp/ox-groff.el: Fix compiler warning, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 16e680a4ff 02/10: lisp/ox-s5.el: Use non-obsolete cl-lib name, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 2a77f1de0c 03/10: lisp/org-expiry.el: Fix compiler warnings, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 4d4126b341 04/10: lisp/org-expiry.el: Switch to lexical binding, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 8d76dd5b43 07/10: lisp/org-checklist.el: Switch to lexical binding, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib de908f3516 09/10: lisp/ox-bibtex.el: Fix some compiler warnings, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 8d07b9491a 10/10: lisp/ox-bibtex.el: Switch to lexical binding, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib b2c5460598 05/10: lisp/ob-stata.el: Keep ESS optional to pacify compiler, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 95008ce07a 06/10: lisp/org-checklist.el: Handle compiler warnings about a2ps-print library, ELPA Syncer, 2024/01/17
- [nongnu] elpa/org-contrib 89931aece2 08/10: lisp/ox-bibtex.el: Convert obsolete `defadvice' to `define-advice',
ELPA Syncer <=