From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?5pu+5L+K6LOi?= Subject: A proposal to integrate org-mode with bookmark+ (bookmark plus / bmkp) , org-bookmark and evince for bookmarking source code and pdf documents with exact coordinate Date: Sun, 17 Feb 2013 08:25:13 +0800 (CST) Message-ID: <1361060713.25580.YahooMailNeo@web74406.mail.tp2.yahoo.com> Reply-To: =?utf-8?B?5pu+5L+K6LOi?= Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6s4I-0002PO-Rv for emacs-orgmode@gnu.org; Sat, 16 Feb 2013 19:25:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6s4F-0005o2-AG for emacs-orgmode@gnu.org; Sat, 16 Feb 2013 19:25:22 -0500 Received: from nm1.bullet.mail.tp2.yahoo.com ([203.188.200.83]:44103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6s4E-0005mG-00 for emacs-orgmode@gnu.org; Sat, 16 Feb 2013 19:25:19 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" Hi there. =0A=0A=0AI'm very interested in the potential applications of org= -mode, and spent some time to write some code to facilitate the integration= between bookmark+ and evince.=0A=0AI'd like to share the code with you and= discuss with you about it.=0A=0A=0AThere are primarily two use cases.=0A= =0A- To bookmark source code files (*.c *.h) with bookmark+=0A=0A=C2=A0=C2= =A0 - essentially there's already org-bookmark.el in the contrib. accompany= ing org-mode.=0A=0A=C2=A0=C2=A0 - when browsing codes, I bookmark with C-x = r m , then enter the name, then a bookmark is created for me=0A=0A=C2=A0=C2= =A0 - then copy this bookmark with C-c l=EF=BC=8Cthen in the org file C-c C= -l to insert this bookmark link=0A=0A=C2=A0=C2=A0 - I made two changes here= ;=0A=0A=C2=A0=C2=A0=C2=A0=C2=A0 - when opening a bookmark link, I need to e= nsure that bookmark+'s *Bookmark List* buffer is open in case it opens the = vallina bookmark list=0A=0A=C2=A0=C2=A0=C2=A0=C2=A0 - really need the opene= d file shown in the other buffer=0A=0A=C2=A0=C2=A0 - the changes I made:=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0Adiff --git a/home/sig/src/org-= mode/contrib/lisp/org-bookmark.el b/home/sig/Dropbox/emacs/lisp/org-bookmar= k.el=0Aindex 5c669b0..170bd57 100644=0A--- a/home/sig/src/org-mode/contrib/= lisp/org-bookmark.el=0A+++ b/home/sig/Dropbox/emacs/lisp/org-bookmark.el=0A= @@ -52,7 +52,9 @@ Otherwise prompt the user for the right bookmark to use."= =0A=C2=A0=0A=C2=A0(defun org-bookmark-open (bookmark)=0A=C2=A0=C2=A0 "Visit= the bookmark BOOKMARK."=0A-=C2=A0 (bookmark-jump bookmark))=0A+=C2=A0 (unl= ess (get-buffer "*Bookmark List*")=0A+=C2=A0=C2=A0=C2=A0 (bookmark-bmenu-li= st))=0A+=C2=A0 (bookmark-jump-other-window bookmark))=0A=C2=A0=0A=C2=A0(def= un org-bookmark-store-link ()=0A=C2=A0=C2=A0 "Store a link to the current l= ine's bookmark in bookmark list."=0A=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =0A- To bookmark pdf files, which gets a little bit awkward...=0A=0A=C2=A0 = - need to modify evince and create a global minor mode (in bmkp-evince.el a= ttached at the end of this mail) to handle the dbus communication=0A=0A=C2= =A0 - pulled evince following https://live.gnome.org/Evince/GettingEvince= =0A=0A=C2=A0 - I reused the syncview / syncsource calls, testing if auctex = is present; if not, then fall back into vallina mode in which=0A=0A=C2=A0 -= when C- in evince, send a syncsource dbus message with filena= me, page number and y coordinate=0A=0A=C2=A0=C2=A0=C2=A0 - the global minor= mode picks up the syncsource message and add a customized bookmark with cu= stomized handler=0A=0A=C2=A0=C2=A0=C2=A0 - then copy this bookmark with C-c= l=EF=BC=8Cthen in the org file C-c C-l to insert this bookmark=0A=0A=C2=A0= - when following the bookmark link in an org file, call the customized han= dler,=0A=0A=C2=A0=C2=A0=C2=A0 - which in turn calls syncview, which opens t= he pdf file and scroll the document to the place bookmarked=0A=0A=C2=A0 - k= now issues=0A=0A=C2=A0=C2=A0=C2=A0 - when the file is not already open, the= call to syncview will open the file; however the scrolling is broken someh= ow; any following call to syncview works just fine; don't know why...=0A=0A= =C2=A0=C2=A0=C2=A0 - I tried to make autoloads work in=C2=A0 bmkp-evince.el= but failed; don't know why...=0A=0A=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =0Adiff --git a/libview/ev-view.c b/libview/ev-view.c=0Aindex dd6b728..91bc= 096 100644=0A--- a/libview/ev-view.c=0A+++ b/libview/ev-view.c=0A@@ -3055,1= 3 +3055,15 @@ ev_view_synctex_backward_search (EvView *view,=0A=C2=A0=C2=A0= =C2=A0=C2=A0 gint x_new =3D 0, y_new =3D 0;=0A=C2=A0=C2=A0=C2=A0=C2=A0 EvSo= urceLink *link;=0A=C2=A0=0A-=C2=A0=C2=A0=C2=A0 if (!ev_document_has_synctex= (view->document))=0A-=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 return FALSE;= =0A=C2=A0=0A=C2=A0=C2=A0=C2=A0=C2=A0 if (!get_doc_point_from_location (view= , x, y, &page, &x_new, &y_new))=0A=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 return FALSE;=0A=C2=A0=0A-=C2=A0=C2=A0=C2=A0 link =3D ev_document_synct= ex_backward_search (view->document, page, x_new, y_new);=0A+=C2=A0=C2=A0=C2= =A0 if (ev_document_has_synctex (view->document))=0A+=C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 link =3D ev_document_synctex_backward_search (view->documen= t, page, x_new, y_new);=0A+=C2=A0=C2=A0=C2=A0 else=0A+=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 link =3D ev_source_link_new(g_path_get_basename(ev_docum= ent_get_uri(view->document)), page+1, y_new);=0A+=0A=C2=A0=C2=A0=C2=A0=C2= =A0 if (link) {=0A=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 g_signal_emit= (view, signals[SIGNAL_SYNC_SOURCE], 0, link);=0A=C2=A0=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 ev_source_link_free (link);=0A@@ -6023,7 +6025,16 @@ ev_= view_highlight_forward_search (EvView=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *= view,=0A=C2=A0=C2=A0=C2=A0=C2=A0 GdkRectangle view_rect;=0A=C2=A0=0A=C2=A0= =C2=A0=C2=A0=C2=A0 if (!ev_document_has_synctex (view->document))=0A-=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 return;=0A+=C2=A0=C2=A0=C2=A0 {=0A+=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 page=3Dlink->line-1;=0A+=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 ev_document_model_set_page (view->model, page);=0A+=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 EvRectangle rect;=0A+=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 GdkRectangle view_rect;=0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 view_rect.x=3D0;=C2=A0=C2=A0=C2=A0 view_rect.y=3D0;=C2=A0=C2=A0= =C2=A0 view_rect.width=3D0;=C2=A0 view_rect.height=3D0;=0A+=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 rect.x1=3D0;=C2=A0 rect.y1=3Dlink->col;=C2=A0 rect.x= 2=3D0;=C2=A0 rect.y2=3Dlink->col;=0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = _ev_view_transform_doc_rect_to_view_rect (view, page, &rect, &view_rect);= =0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ensure_rectangle_is_visible (view= , &view_rect);=0A+=C2=A0=C2=A0=C2=A0 }else{=0A=C2=A0=0A=C2=A0=C2=A0=C2=A0= =C2=A0 mapping =3D ev_document_synctex_forward_search (view->document, link= );=0A=C2=A0=C2=A0=C2=A0=C2=A0 if (!mapping)=0A@@ -6038,6 +6049,7 @@ ev_view= _highlight_forward_search (EvView=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *view= ,=0A=C2=A0=0A=C2=A0=C2=A0=C2=A0=C2=A0 _ev_view_transform_doc_rect_to_view_r= ect (view, page, &mapping->area, &view_rect);=0A=C2=A0=C2=A0=C2=A0=C2=A0 en= sure_rectangle_is_visible (view, &view_rect);=0A+=C2=A0=C2=A0=C2=A0 }=0A=C2= =A0=C2=A0=C2=A0=C2=A0 gtk_widget_queue_draw (GTK_WIDGET (view));=0A=C2=A0}= =0A=C2=A0=0Adiff --git a/shell/ev-window.c b/shell/ev-window.c=0Aindex 97f4= a90..b6414a1 100644=0A--- a/shell/ev-window.c=0A+++ b/shell/ev-window.c=0A@= @ -7006,6 +7006,16 @@ handle_sync_view_cb (EvEvinceWindow=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 *object,=0A=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 gtk_window_present_with_time (GTK_WINDOW (window), timestamp);=0A=C2= =A0=C2=A0=C2=A0=C2=A0 }=0A=C2=A0=0A+=C2=A0=C2=A0=C2=A0 else if (window->pri= v->document) {=0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 EvSourceLink link;= =0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 link.filename =3D (char *) source= _file;=0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 g_variant_get (source_point= , "(ii)", &link.line, &link.col);=0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = ev_view_highlight_forward_search (EV_VIEW (window->priv->view), &link);=0A+= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 gtk_window_present_with_time (GTK_WIN= DOW (window), timestamp);=0A+=C2=A0=C2=A0=C2=A0 }else {=0A+=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 g_message("FILE NOT OPENED!! source_file: %s", sourc= e_file);=0A+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 return FALSE;=0A+=C2=A0= =C2=A0=C2=A0 }=0A=C2=A0=C2=A0=C2=A0=C2=A0 ev_evince_window_complete_sync_vi= ew (object, invocation);=0A=C2=A0=0A=C2=A0=C2=A0=C2=A0=C2=A0 return TRUE;= =0A=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A- and here comes bmkp-evince.e= l=0A=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A;;;###autoload (autoload 'o= bmkp-evince-dbus-p "bmkp-evince")=0A(defun obmkp-evince-dbus-p (&rest optio= ns)=0A=C2=A0 "Return non-nil, if evince is installed and accessible via DBU= S.=0AAdditional OPTIONS may be given to extend the check.=C2=A0 If none are= =0Agiven, only the minimal requirements needed by backward search=0Aare che= cked.=C2=A0 If OPTIONS include `:forward', which is currently=0Athe only op= tion, then additional requirements needed by forward=0Asearch are checked, = too."=0A=C2=A0 (and (not (featurep 'xemacs)) ; XEmacs 21.4 has no `require'= with=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ; arity 3, and no dbus support anyway.=0A= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (require 'dbus nil :no-error)=0A=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (functionp 'dbus-register-signal)=0A=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (getenv "DBUS_SESSION_BUS_ADDRESS")=0A=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (executable-find "evince")=0A=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (or (not (memq :forward options))=0A=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0 (let ((spec (dbus-introspect-get-method=0A=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 :session "org.gnome.evince.Daemon= "=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 "/org/gnome/ev= ince/Daemon"=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 "or= g.gnome.evince.Daemon"=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 "FindDocument")))=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; F= indDocument must exist, and its signature must be (String,=0A=C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; Boolean, String).=C2=A0 Evince versions = between 2.30 and 2.91.x=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; di= dn't have the Boolean spawn argument we need to start evince=0A=C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; initially.=0A=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0=C2=A0 (and spec=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= (equal '("s" "b" "s")=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0(delq nil (mapcar (lambda (elem)=0A=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0 (when (and (listp elem)=0A=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (eq (car elem) 'arg))=0A=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cdr (caar (cdr elem)))))=0A=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 spec))))))))=0A=0A;;;###autoload (autoload = 'bmkp-jump-evince "bmkp-evince")=0A(defun bmkp-jump-evince (bookmark)=0A=C2= =A0 "BOOKMARK is a bookmark name or a bookmark record."=0A=C2=A0 (message "= =C2=A0 ;; Implements the `handler' ")=0A=C2=A0 (let* =0A=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ((file=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (bookmark-prop-get = bookmark 'filename))=0A=C2=A0=C2=A0=C2=A0 =C2=A0(apage=C2=A0 (bookmark-prop= -get bookmark 'page))=0A=C2=A0=C2=A0=C2=A0 =C2=A0(acoory=C2=A0 (bookmark-pr= op-get bookmark 'coory)))=0A=C2=A0=C2=A0=C2=A0 (let* ((uri (concat "file://= " file))=0A=C2=A0=C2=A0=C2=A0 =C2=A0 (message uri)=0A=C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0 (owner (dbus-call-method=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0 :session "org.gnome.evince.Daemon"=0A=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0 "/org/gnome/evince/Daemon"=0A=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 "org.gnome.evince.Daemon"=0A=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 "FindDocument"=0A=C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0 uri=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0 t)))=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if owner=0A;=C2=A0=C2= =A0=C2=A0 =C2=A0 (message "owner")=0A=C2=A0=C2=A0=C2=A0 =C2=A0 (dbus-call-m= ethod=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 :session owner=0A=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 "/org/gnome/evince/Window/0"=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0 "org.gnome.evince.Window"=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 "SyncView"= =0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 file;(buffer-file-name)=0A=C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0 (list :struct :int32 apage :int32 acoory)=0A=C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0 :uint32 (let ((time (float-time)))=0A=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; FIXME: Evince wants a ti= mestamp as UInt32, but POSIX time=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0=C2=A0 ;; is too large for emacs integers on 32 bit syste= ms.=C2=A0 Emacs=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0 ;; 24.2 will allow providing DBUS ints as floats, and this=0A=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; dbus version wi= ll be identifiable by its new variables=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; `dbus-compiled-version' and `dbus-runtim= e-version'.=C2=A0 But=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0=C2=A0 ;; it seems providing just 1 as timestamp has no negative=0A= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ;; consequen= ces, anyway.=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 (if (> most-positive-fixnum time)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0(round time)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1)))=0A=C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0 (error "Couldn't find the Evince instance for %s" uri)))=0A=C2=A0= =C2=A0=C2=A0 ))=0A=0A;;;###autoload (autoload 'obmkp-source-correlate-sync-= source "bmkp-evince")=0A(defun obmkp-source-correlate-sync-source (file lin= ecol &rest ignored)=0A=C2=A0 "Show TeX FILE with point at LINECOL.=0AThis f= unction is called when emacs receives a SyncSource signal=0Aemitted from th= e Evince document viewer.=C2=A0 IGNORED absorbs an=0Aunused id field accomp= anying the DBUS signal sent by Evince-3.0.0=0Aor newer."=0A=C2=A0 ;; FILE m= ay be given as relative path to the TeX-master root document or as=0A=C2=A0= ;; absolute file:// URL.=C2=A0 In the former case, the tex file has to be = already=0A=C2=A0 ;; opened.=0A(message "obmkp-source-correlate-sync-source"= )=0A=C2=A0(let* =0A=C2=A0=C2=A0=C2=A0=C2=A0 (=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (ctime=C2=A0=C2=A0=C2=A0 (current-time))=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (f (condition-case nil=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 (p= rogn=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (require 'ur= l-parse)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (aref (u= rl-generic-parse-url file) 6)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 )=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 ;; For Emacs 21 compatibil= ity, which doesn't have the=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 ;; url packag= e.=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 (file-error (replace-regexp-in-string = "^file://" "" file))=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 ))=0A=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (apage (car linecol))=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (aco= ory (cadr linecol))=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (bookmark-name (format= "%i:%i@%s" apage acoory (file-name-nondirectory f) ))=0A=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 )=0A=C2=A0 (bookmark-store bookmark-name=0A=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0 `((filename . ,f)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 (handler=C2=A0 . bmkp-jump-evince)=0A=C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (version=C2=A0 . "20130210"= )=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (page=C2=A0=C2= =A0=C2=A0=C2=A0 . ,apage)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 (coory=C2=A0=C2=A0 . ,acoory)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 (notes=C2=A0=C2=A0=C2=A0 . "")=0A=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (visits=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 . 0)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 (time=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 . ,ctime)=0A=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (created=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 . ,ctime)=0A=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 )=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 nil nil nil)=0A=C2=A0 (let ((= new=C2=A0 (bmkp-bookmark-record-from-name bookmark-name 'NOERROR)))=0A=C2= =A0=C2=A0=C2=A0 (unless (memq new bmkp-latest-bookmark-alist)=0A=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (setq bmkp-latest-bookmark-alist=C2=A0 (cons new bmkp= -latest-bookmark-alist)))=0A=C2=A0=C2=A0=C2=A0 (bookmark-bmenu-surreptitiou= sly-rebuild-list nil)=0A=C2=A0=C2=A0=C2=A0 new)=0A=C2=A0=C2=A0 )=0A=C2=A0 )= =0A=0A;;;###autoload (autoload 'obmkp-source-correlate-mode "bmkp-evince")= =0A(define-minor-mode obmkp-source-correlate-mode=0A=C2=A0 "Minor mode for = forward and inverse search.=0A=0AIf enabled, the viewer can be advised to s= how the output page=0Acorresponding to the point in the source and vice ver= sa.=0A=0AThe method to be used can be controlled with the variable=0A`TeX-s= ource-correlate-method'.=C2=A0 Currently source specials or=0ASyncTeX are r= ecognized."=0A=C2=A0 ;:group 'TeX-view=0A=C2=A0 ;; Since this is a global m= inor mode and we don't want to require=0A=C2=A0 ;; tex.el when the mode var= iable is set, the mode function is called=0A=C2=A0 ;; explicitely (if neces= sary) in `VirTeX-common-initialization'.=C2=A0 We=0A=C2=A0 ;; do it there b= ecause otherwise `kill-all-local-variables' would=0A=C2=A0 ;; reset `TeX-so= urce-correlate-output-page-function' which is=0A=C2=A0 ;; buffer-local.=0A= =C2=A0 :global t=0A=0A;=C2=A0 (obmkp-set-mode-name 'obmkp-source-correlate-= mode t t)=0A;=C2=A0 (setq obmkp-source-correlate-start-server-flag obmkp-so= urce-correlate-mode)=0A=C2=A0 ;; Register Emacs for the SyncSource DBUS sig= nal emitted by Evince.=0A=C2=A0 (when (obmkp-evince-dbus-p)=0A=C2=A0=C2=A0= =C2=A0 (dbus-register-signal=0A=C2=A0=C2=A0=C2=A0=C2=A0 :session nil "/org/= gnome/evince/Window/0"=0A=C2=A0=C2=A0=C2=A0=C2=A0 "org.gnome.evince.Window"= "SyncSource"=0A=C2=A0=C2=A0=C2=A0=C2=A0 'obmkp-source-correlate-sync-sourc= e))=0A;=C2=A0 (unless obmkp-source-correlate-method-active=0A;=C2=A0=C2=A0= =C2=A0 (setq obmkp-source-correlate-method-active=0A; =C2=A0=C2=A0=C2=A0 = =C2=A0 (if (eq obmkp-source-correlate-method 'auto)=0A; =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (obmkp-source-correlate-determine-method)=0A= ; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 obmkp-source-correlate-method)))=0A= ;=C2=A0 (when (eq obmkp-source-correlate-method-active 'synctex)=0A;=C2=A0= =C2=A0=C2=A0 (setq obmkp-source-correlate-output-page-function=0A; =C2=A0= =C2=A0=C2=A0 =C2=A0 (when obmkp-source-correlate-mode=0A; =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 'obmkp-synctex-output-page)))=0A)=0A(provide 'bmkp-e= vince)=0A=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A