emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-bookmark.el
@ 2008-02-27 15:39 Tokuya Kameshima
  2008-02-27 16:06 ` org-bookmark.el Carsten Dominik
  2008-02-27 16:21 ` org-bookmark.el Bastien Guerry
  0 siblings, 2 replies; 11+ messages in thread
From: Tokuya Kameshima @ 2008-02-27 15:39 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: kames

Hi,

I wrote an emacs code, org-bookmark.el, which supports for orgmode
links to Emacs bookmarks.  You can store the links in the Bookmark
List buffer by running M-x org-store-link.

Not sure it's useful, but I regularly uses this bookmark links to
follow daily or weekly changing file links.

Thanks,
--Tokuya

\f
;;; org-bookmark.el - Support for links to Emacs bookmark
;; Carstens outline-mode for keeping track of everything.
;; 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 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)

(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 Emacs bookmark list window."
  (if (eq major-mode 'bookmark-bmenu-mode)
      (let ((bookmark (bookmark-bmenu-bookmark)))
	(if bookmark
	    (org-store-link-props :link (org-make-link "bookmark:" bookmark)
				  :description bookmark)))))

(provide 'org-bookmark)

;;; org-bookmark.el ends here

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-27 15:39 org-bookmark.el Tokuya Kameshima
@ 2008-02-27 16:06 ` Carsten Dominik
  2008-02-27 16:21 ` org-bookmark.el Bastien Guerry
  1 sibling, 0 replies; 11+ messages in thread
From: Carsten Dominik @ 2008-02-27 16:06 UTC (permalink / raw)
  To: Tokuya Kameshima; +Cc: emacs-orgmode

Hi Tokuya,

this is nice, do you want me to add this to our distribution?

- Carsten

On Feb 27, 2008, at 4:39 PM, Tokuya Kameshima wrote:

> Hi,
>
> I wrote an emacs code, org-bookmark.el, which supports for orgmode
> links to Emacs bookmarks.  You can store the links in the Bookmark
> List buffer by running M-x org-store-link.
>
> Not sure it's useful, but I regularly uses this bookmark links to
> follow daily or weekly changing file links.
>
> Thanks,
> --Tokuya
>
>
> ;;; org-bookmark.el - Support for links to Emacs bookmark
> ;; Carstens outline-mode for keeping track of everything.
> ;; 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 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)
>
> (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 Emacs bookmark list  
> window."
>  (if (eq major-mode 'bookmark-bmenu-mode)
>      (let ((bookmark (bookmark-bmenu-bookmark)))
> 	(if bookmark
> 	    (org-store-link-props :link (org-make-link "bookmark:" bookmark)
> 				  :description bookmark)))))
>
> (provide 'org-bookmark)
>
> ;;; org-bookmark.el ends here
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  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 ` Bastien Guerry
  2008-02-28 14:20   ` org-bookmark.el Tokuya Kameshima
  1 sibling, 1 reply; 11+ messages in thread
From: Bastien Guerry @ 2008-02-27 16:21 UTC (permalink / raw)
  To: Tokuya Kameshima; +Cc: emacs-orgmode

Tokuya Kameshima <kames@fa2.so-net.ne.jp> writes:

> I wrote an emacs code, org-bookmark.el, which supports for orgmode
> links to Emacs bookmarks.  You can store the links in the Bookmark
> List buffer by running M-x org-store-link.

Great, thanks.

> Not sure it's useful, but I regularly uses this bookmark links to
> follow daily or weekly changing file links.

I guess it is useful for those who prefer to update their bookmarks
rather than to update their Org links directly.

On top of this, when `org-bookmark' is in use, storing a link while
visiting a file (or while in dired-mode) could first check if the file
at point is bookmarked: if it is, then `org-bookmark-store-link' would
be used; if it isn't, storing the file would fall back on the current
mechanism.  

BTW, would you be okay to add this to the CONTRIB/ directory in the git
repository?  Let me know, I can do it for you.

> ;;; org-bookmark.el - Support for links to Emacs bookmark
> ;; Carstens outline-mode for keeping track of everything.
> ;; 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 part of GNU Emacs.

This line should rather mention: 

  "This file is not part of GNU Emacs."

-- 
Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-27 16:21 ` org-bookmark.el Bastien Guerry
@ 2008-02-28 14:20   ` Tokuya Kameshima
  2008-02-28 15:04     ` org-bookmark.el Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Tokuya Kameshima @ 2008-02-28 14:20 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: kames

Carstens and Bastien,

Thank you for your comments and suggestions.  I would appreciate if
you add the code to the distribution.

> On top of this, when `org-bookmark' is in use, storing a link while
> visiting a file (or while in dired-mode) could first check if the file
> at point is bookmarked: if it is, then `org-bookmark-store-link' would
> be used; if it isn't, storing the file would fall back on the current
> mechanism.  

It sounds nice.  But it is possible for a single file to be bookmarked
by two or more.  I can not find a good way to select one from multiple
bookmarks referring to the same file.  Do you have any idea?

At the end of this mail, I attached the revised elisp code.
Only ";; This file is not part of GNU Emacs." line is updated.

Thanks,
--Tokuya


On Wed, 27 Feb 2008 16:21:46 +0000,
Bastien Guerry <Bastien.Guerry@ens.fr> wrote:
> 
> Tokuya Kameshima <kames@fa2.so-net.ne.jp> writes:
> 
> > I wrote an emacs code, org-bookmark.el, which supports for orgmode
> > links to Emacs bookmarks.  You can store the links in the Bookmark
> > List buffer by running M-x org-store-link.
> 
> Great, thanks.
> 
> > Not sure it's useful, but I regularly uses this bookmark links to
> > follow daily or weekly changing file links.
> 
> I guess it is useful for those who prefer to update their bookmarks
> rather than to update their Org links directly.
> 
> On top of this, when `org-bookmark' is in use, storing a link while
> visiting a file (or while in dired-mode) could first check if the file
> at point is bookmarked: if it is, then `org-bookmark-store-link' would
> be used; if it isn't, storing the file would fall back on the current
> mechanism.  
> 
> BTW, would you be okay to add this to the CONTRIB/ directory in the git
> repository?  Let me know, I can do it for you.
> 
> > ;;; org-bookmark.el - Support for links to Emacs bookmark
> > ;; Carstens outline-mode for keeping track of everything.
> > ;; 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 part of GNU Emacs.
> 
> This line should rather mention: 
> 
>   "This file is not part of GNU Emacs."
> 
> -- 
> Bastien

\f
;;; org-bookmark.el - Support for links to Emacs bookmark
;; Carstens outline-mode for keeping track of everything.
;; 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)

(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 Emacs bookmark list window."
  (if (eq major-mode 'bookmark-bmenu-mode)
      (let ((bookmark (bookmark-bmenu-bookmark)))
	(if bookmark
	    (org-store-link-props :link (org-make-link "bookmark:" bookmark)
				  :description bookmark)))))

(provide 'org-bookmark)

;;; org-bookmark.el ends here

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-28 14:20   ` org-bookmark.el Tokuya Kameshima
@ 2008-02-28 15:04     ` Bastien
  2008-02-28 16:02       ` org-bookmark.el Phil Jackson
  0 siblings, 1 reply; 11+ messages in thread
From: Bastien @ 2008-02-28 15:04 UTC (permalink / raw)
  To: Tokuya Kameshima; +Cc: emacs-orgmode

Tokuya Kameshima <kames@fa2.so-net.ne.jp> writes:

> Thank you for your comments and suggestions.  I would appreciate if
> you add the code to the distribution.

Done, thanks!

>> On top of this, when `org-bookmark' is in use, storing a link while
>> visiting a file (or while in dired-mode) could first check if the file
>> at point is bookmarked: if it is, then `org-bookmark-store-link' would
>> be used; if it isn't, storing the file would fall back on the current
>> mechanism.  
>
> It sounds nice.  But it is possible for a single file to be bookmarked
> by two or more.  I can not find a good way to select one from multiple
> bookmarks referring to the same file.  Do you have any idea?

Either use an option like:

  (setq org-bookmark-store-link-select-first-bookmark t)

or interactively ask the user for the bookmark to use in the minibuffer? 

In any case, this should be implemented in org.el directly.  When
`org-store-link' checks whether we are in dired-mode or in a buffer
visiting a file, then it would also check whether 'org-bookmark is
provided (with (featurep 'org-bookmark)...) and act accordingly if 
it is.

Mhh... I will have a look at this this WE. 

-- 
Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-28 15:04     ` org-bookmark.el Bastien
@ 2008-02-28 16:02       ` Phil Jackson
  2008-02-28 19:54         ` org-bookmark.el Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Phil Jackson @ 2008-02-28 16:02 UTC (permalink / raw)
  To: Bastien; +Cc: Tokuya Kameshima, emacs-orgmode

Bastien <bzg@altern.org> writes:

> In any case, this should be implemented in org.el directly.  When
> `org-store-link' checks whether we are in dired-mode or in a buffer
> visiting a file, then it would also check whether 'org-bookmark is
> provided (with (featurep 'org-bookmark)...) and act accordingly if it
> is.

I don't think it needs to go into org.el does it? When org-bookmark gets
it's turn upon `org-store-link' it should check a variable called, for
example, `org-bookmark-check-bookmarks-first' and then if that's non-nil
check major-mode and act accordingly. This will keep `org-store-link'
nice and clean.

Cheers,
Phil
-- 
 Phil Jackson
 http://www.shellarchive.co.uk

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-28 16:02       ` org-bookmark.el Phil Jackson
@ 2008-02-28 19:54         ` Bastien
  2008-02-28 20:53           ` org-bookmark.el Phil Jackson
  0 siblings, 1 reply; 11+ messages in thread
From: Bastien @ 2008-02-28 19:54 UTC (permalink / raw)
  To: Phil Jackson; +Cc: Tokuya Kameshima, emacs-orgmode

Phil Jackson <phil@shellarchive.co.uk> writes:

> Bastien <bzg@altern.org> writes:
>
>> In any case, this should be implemented in org.el directly.  When
>> `org-store-link' checks whether we are in dired-mode or in a buffer
>> visiting a file, then it would also check whether 'org-bookmark is
>> provided (with (featurep 'org-bookmark)...) and act accordingly if it
>> is.
>
> I don't think it needs to go into org.el does it? When org-bookmark gets
> it's turn upon `org-store-link' it should check a variable called, for
> example, `org-bookmark-check-bookmarks-first' and then if that's non-nil
> check major-mode and act accordingly. This will keep `org-store-link'
> nice and clean.

Of course, you're right.

But I doubt whether `org-bookmark-check-bookmarks-first' would be useful
here.  People using `org-bookmark.el' are likely to use it in dired-mode
and in buffer visiting files as well.  Actually, I would use it just for
that (not really for creating links from the bookmarks list.)

`org-bookmark-store-link' could just check if we are in a dired buffer,
in a buffer visiting a file, or in a bookmark list, and act accordingly.

When in dired or visiting a file, it would try to fetch a bookmark.  
If there are more than one, then it will prompt the user for the 
bookmark to use.

Tokuya, what do you think?  
Do you want to implement this?

-- 
Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-28 19:54         ` org-bookmark.el Bastien
@ 2008-02-28 20:53           ` Phil Jackson
  2008-02-29  1:14             ` org-bookmark.el Bastien Guerry
  0 siblings, 1 reply; 11+ messages in thread
From: Phil Jackson @ 2008-02-28 20:53 UTC (permalink / raw)
  To: Bastien; +Cc: Tokuya Kameshima, emacs-orgmode

Bastien <bzg@altern.org> writes:

>> I don't think it needs to go into org.el does it? When org-bookmark gets
>> it's turn upon `org-store-link' it should check a variable called, for
>> example, `org-bookmark-check-bookmarks-first' and then if that's non-nil
>> check major-mode and act accordingly. This will keep `org-store-link'
>> nice and clean.

> Of course, you're right.
>
> But I doubt whether `org-bookmark-check-bookmarks-first' would be
> useful here.  People using `org-bookmark.el' are likely to use it in
> dired-mode and in buffer visiting files as well.  Actually, I would
> use it just for that (not really for creating links from the bookmarks
> list.)

I don't think that just through the act of loading a module the
unrelated default behaviour should change. I would put a vote in for
this behaviour to be off by default (but then I don't use bookmarks).

Cheers,
Phil
-- 
 Phil Jackson
 http://www.shellarchive.co.uk

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-28 20:53           ` org-bookmark.el Phil Jackson
@ 2008-02-29  1:14             ` Bastien Guerry
  2008-02-29 14:25               ` org-bookmark.el Tokuya Kameshima
  0 siblings, 1 reply; 11+ messages in thread
From: Bastien Guerry @ 2008-02-29  1:14 UTC (permalink / raw)
  To: Phil Jackson; +Cc: Tokuya Kameshima, emacs-orgmode

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

Phil Jackson <phil@shellarchive.co.uk> writes:

> Bastien <bzg@altern.org> writes:
>
>>> I don't think it needs to go into org.el does it? When org-bookmark gets
>>> it's turn upon `org-store-link' it should check a variable called, for
>>> example, `org-bookmark-check-bookmarks-first' and then if that's non-nil
>>> check major-mode and act accordingly. This will keep `org-store-link'
>>> nice and clean.
>
>> Of course, you're right.
>>
>> But I doubt whether `org-bookmark-check-bookmarks-first' would be
>> useful here.  People using `org-bookmark.el' are likely to use it in
>> dired-mode and in buffer visiting files as well.  Actually, I would
>> use it just for that (not really for creating links from the bookmarks
>> list.)
>
> I don't think that just through the act of loading a module the
> unrelated default behaviour should change. I would put a vote in for
> this behaviour to be off by default (but then I don't use bookmarks).

I've made some changes on org-bookmark.el in the git repository.

I added three options: 

 org-bookmark-in-dired nil
 org-bookmark-when-visiting-a-file nil
 org-bookmark-use-first-bookmark nil

By default, the behavior is the same than what Tokuya proposed.  
But turning the options on, it will let you use org-bookmark to 
link to a bookmark if the buffer is visiting a bookmarked file.  

Tokuya, this is quite a big change on your original code.  
Please feel free to tell me you prefer to keep your original 
code in the CONTRIB/ section instead of this one.

Thanks,


[-- Attachment #2: org-bookmark.el --]
[-- Type: application/emacs-lisp, Size: 3009 bytes --]

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


-- 
Bastien

[-- Attachment #4: 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-29  1:14             ` org-bookmark.el Bastien Guerry
@ 2008-02-29 14:25               ` Tokuya Kameshima
  2008-02-29 18:47                 ` org-bookmark.el Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Tokuya Kameshima @ 2008-02-29 14:25 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-orgmode

[-- 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: org-bookmark.el
  2008-02-29 14:25               ` org-bookmark.el Tokuya Kameshima
@ 2008-02-29 18:47                 ` Bastien
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2008-02-29 18:47 UTC (permalink / raw)
  To: Tokuya Kameshima; +Cc: emacs-orgmode

Tokuya Kameshima <kames@fa2.so-net.ne.jp> writes:

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

Ok, good.

> 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.

Done, thanks!

-- 
Bastien

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-02-29 18:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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               ` org-bookmark.el Tokuya Kameshima
2008-02-29 18:47                 ` org-bookmark.el Bastien

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).