emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Bastien <bastien.guerry@wikimedia.fr>
Cc: Org Mode <emacs-orgmode@gnu.org>,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: [PATCH] Re: Unintended behavior? Links without description
Date: Sun, 13 Feb 2011 13:45:18 +0100	[thread overview]
Message-ID: <4D57D25E.408@christianmoe.com> (raw)
In-Reply-To: <87hbc8vr7k.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

bbdb: Export links with normalized desc part

* org-bbdb.el (org-bbdb-export): When a link description has been
added by org-export-normalize-links, use path instead (remove the
`bbdb:' prefix).

The existing code handled the case where desc is nil. However, this no
longer occurs, since org-export-normalize-links now automatically adds
a desc to links, with a `bbdb:' prefix that would not usually be
wanted in exported text. The patch results in the same output as
originally intended.

TINYCHANGE


diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el
index c04b7ff..1d3252c 100644
--- a/lisp/org-bbdb.el
+++ b/lisp/org-bbdb.el
@@ -208,10 +208,12 @@ date year)."
    "Create the export version of a BBDB link specified by PATH or DESC.
  If exporting to either HTML or LaTeX FORMAT the link will be
  italicized, in all other cases it is left unchanged."
+  (when (string= desc (format "bbdb:%s" path))
+    (setq desc path))
    (cond
-   ((eq format 'html) (format "<i>%s</i>" (or desc path)))
-   ((eq format 'latex) (format "\\textit{%s}" (or desc path)))
-   (t (or desc path))))
+   ((eq format 'html) (format "<i>%s</i>" desc))
+   ((eq format 'latex) (format "\\textit{%s}" desc))
+   (t desc)))

  (defun org-bbdb-open (name)
    "Follow a BBDB link to NAME."


[-- Attachment #2: org-bbdb.el.diff --]
[-- Type: text/plain, Size: 762 bytes --]

diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el
index c04b7ff..1d3252c 100644
--- a/lisp/org-bbdb.el
+++ b/lisp/org-bbdb.el
@@ -208,10 +208,12 @@ date year)."
   "Create the export version of a BBDB link specified by PATH or DESC.
 If exporting to either HTML or LaTeX FORMAT the link will be
 italicized, in all other cases it is left unchanged."
+  (when (string= desc (format "bbdb:%s" path)) 
+    (setq desc path))
   (cond
-   ((eq format 'html) (format "<i>%s</i>" (or desc path)))
-   ((eq format 'latex) (format "\\textit{%s}" (or desc path)))
-   (t (or desc path))))
+   ((eq format 'html) (format "<i>%s</i>" desc))
+   ((eq format 'latex) (format "\\textit{%s}" desc))
+   (t desc)))
 
 (defun org-bbdb-open (name)
   "Follow a BBDB link to NAME."

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2011-02-13 12:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 10:29 Unintended behavior? Links without description Christian Moe
2010-12-31 20:09 ` Thomas S. Dye
2011-02-12 22:11 ` Bastien
2011-02-13 12:45   ` Christian Moe [this message]
2011-02-15  4:38     ` [PATCH] " Bastien
2011-02-13 12:49   ` Christian Moe
2011-02-15  4:39     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D57D25E.408@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=bastien.guerry@wikimedia.fr \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).