emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] link interfering with brackets when abbreviated


From: Michael Brand
Subject: Re: [O] link interfering with brackets when abbreviated
Date: Mon, 3 Mar 2014 06:54:29 +0100

Hi all

On Sun, Mar 2, 2014 at 4:49 PM, Bastien <address@hidden> wrote:
> In the meantime, other users' voices can help us step back and
> see things differently.

May I ask at least Nicolas and Bastien:

When you carefully reread my last post (Thursday)
http://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00991.html
of this thread: Is it clear that when point is after the character "x"

    - x y [2014-03-03 Mon] z t http://orgmode.org

I want to keep "M-x org-open-at-point" to result in the error "No link
found", in any case?


The other reason for this post is an update of my function
f-open-link-between-point-and-eol to deal with links in Org mode that
occur in a place that is not a link according to Org syntax (currently
two cases in discussion). I bind this function still to "C-c o". Not
to "C-c C-o", because I want to use f-open-link-between-point-and-eol
also outside of Org and because I want to have the possibility to use
"C-c C-o" to find out on which point not and on which point
org-open-at-point results in the error "No link found", for example to
learn more about Org syntax and how to better cooperate with it.

#+BEGIN_SRC emacs-lisp
  (defun f-open-link-between-point-and-eol ()
    "Move to and open first link between point and end of line.
  As long as not yet at end of line and as long as
  `org-open-at-point' and `browse-url-at-point' result in an error
  advance point by one character. For Org and other major modes."
    (interactive)
    (let ((p (point)) opened)
      (while (not (or (eolp)
                      (progn (ignore-errors
                               (cond
                                ;; Org mode
                                ((eq major-mode 'org-mode)
                                 (org-open-at-point)
                                 (setq opened 'org-open-at-point))
                                ;; Maybe more major modes that have an
                                ;; open function specific to their
                                ;; syntax
                                ))
                             (unless opened
                               (ignore-errors
                                 (browse-url-at-point)
                                 (setq opened 'browse-url-at-point)))
                             opened)))
        (forward-char))
      (if opened
          (message "Link opened with %s" opened)
        (goto-char p)
        (user-error "No link between point and end of line"))))
#+END_SRC

Here f-open-link-between-point-and-eol is with "(org-open-at-point)"
but actually I'm using "(org-open-at-point 1)" instead.

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]