emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tokuya Kameshima <kames@fa2.so-net.ne.jp>
To: Bastien Guerry <Bastien.Guerry@ens.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-bookmark.el
Date: Fri, 29 Feb 2008 23:25:42 +0900	[thread overview]
Message-ID: <ur6evu9eh.wl%kames@fa2.so-net.ne.jp> (raw)
In-Reply-To: <871w6wftrq.fsf@bzg.ath.cx>

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

Hi,

Bastien, thanks for changing the code.  I totally agree with your
suggestion.  The new code is much better!

I also changed the code a little bit as in the attached.  The variable
`bookmark-alist' seems to be an internal variable, so I updated it not
to use the variable.  Please update the git repository.

Thanks,
--Tokuya


[-- Attachment #2: org-bookmark.el --]
[-- Type: application/octet-stream, Size: 3005 bytes --]

;;; org-bookmark.el - Support for links to bookmark
;; Copyright (C) 2008 Free Software Foundation, Inc.
;;
;; Author: Tokuya Kameshima <kames AT fa2.so-net.ne.jp>
;; Version: 1.0
;; Keywords: outlines, hypermedia, calendar, wp
;;
;; This file is not part of GNU Emacs.
;;
;; Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'org)
(require 'bookmark)

(defgroup org-bookmark nil
  "Options concerning the bookmark link."
  :tag "Org Startup"
  :group 'org-link)

(defcustom org-bookmark-in-dired nil
  "Use org-bookmark in dired."
  :group 'org-bookmark
  :type 'boolean)

(defcustom org-bookmark-when-visiting-a-file nil
  "Use org-bookmark in any buffer visiting a file."
  :group 'org-bookmark
  :type 'boolean)

(defcustom org-bookmark-use-first-bookmark nil
  "If several bookmarks links to the buffer, take the first one.
Otherwise prompt the user for the right bookmark to use."
  :group 'org-bookmark
  :type 'boolean)

(org-add-link-type "bookmark" 'org-bookmark-open)
(add-hook 'org-store-link-functions 'org-bookmark-store-link)

(defun org-bookmark-open (bookmark)
  "Visit the bookmark BOOKMARK."
  (bookmark-jump bookmark))

(defun org-bookmark-store-link ()
  "Store a link to the current line's bookmark in bookmark list."
  (let (file bookmark bmks)
    (cond ((and org-bookmark-in-dired
		(eq major-mode 'dired-mode))
	   (setq file (abbreviate-file-name (dired-get-filename))))
	  ((and org-bookmark-when-visiting-a-file
		(buffer-file-name (buffer-base-buffer)))
	   (setq file (abbreviate-file-name
		       (buffer-file-name (buffer-base-buffer))))))
    (if (not file)
	(when (eq major-mode 'bookmark-bmenu-mode)
	  (setq bookmark (bookmark-bmenu-bookmark)))
      (when (and (setq bmks 
		       (mapcar (lambda (name)
				 (if (equal file
					    (abbreviate-file-name
					     (bookmark-location name)))
				     name))
			       (bookmark-all-names)))
		 (setq bmks (delete nil bmks)))
	(setq bookmark 
	      (if (or (eq 1 (length bmks)) org-bookmark-use-first-bookmark)
		  (car bmks)
		(completing-read "Bookmark: " bmks nil t nil nil (car bmks))))))
    (if bookmark
	(org-store-link-props :link (org-make-link "bookmark:" bookmark)
			      :description bookmark))))

(provide 'org-bookmark)

;;; org-bookmark.el ends here

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

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

  reply	other threads:[~2008-02-29 14:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27 15:39 org-bookmark.el Tokuya Kameshima
2008-02-27 16:06 ` org-bookmark.el Carsten Dominik
2008-02-27 16:21 ` org-bookmark.el Bastien Guerry
2008-02-28 14:20   ` org-bookmark.el Tokuya Kameshima
2008-02-28 15:04     ` org-bookmark.el Bastien
2008-02-28 16:02       ` org-bookmark.el Phil Jackson
2008-02-28 19:54         ` org-bookmark.el Bastien
2008-02-28 20:53           ` org-bookmark.el Phil Jackson
2008-02-29  1:14             ` org-bookmark.el Bastien Guerry
2008-02-29 14:25               ` Tokuya Kameshima [this message]
2008-02-29 18:47                 ` org-bookmark.el 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=ur6evu9eh.wl%kames@fa2.so-net.ne.jp \
    --to=kames@fa2.so-net.ne.jp \
    --cc=Bastien.Guerry@ens.fr \
    --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).