* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark @ 2013-12-08 16:54 Andreas Politz 2013-12-09 9:13 ` Tassilo Horn ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Andreas Politz @ 2013-12-08 16:54 UTC (permalink / raw) To: 16090 [-- Attachment #1: Type: text/plain, Size: 459 bytes --] $ emacs -Q some.pdf C-x r m RET C-x k RET C-x r b some.pdf RET Debugger entered--Lisp error: (wrong-type-argument listp t) image-mode-winprops(nil) The reason is that the buffer is not yet displayed, when doc-view-bookmark-jump tries to change the page. This results in, for obscure reasons, trying to change the page in which ever window is currently selected. Solution: Defer changing the page after bookmark--jump-via has displayed the page. -ap [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: Patch --] [-- Type: text/x-diff, Size: 1433 bytes --] === modified file 'lisp/ChangeLog' *** lisp/ChangeLog 2013-12-08 09:18:55 +0000 --- lisp/ChangeLog 2013-12-08 16:11:24 +0000 *************** *** 1,3 **** --- 1,8 ---- + 2013-12-08 Andreas Politz <politza@fh-trier.de> + + * doc-view.el (doc-view-bookmark-jump): Wait for the window to be + displayed before changing the page. + 2013-12-08 Leo Liu <sdl.web@gmail.com> * progmodes/flymake.el (flymake-highlight-line): Re-write. === modified file 'lisp/doc-view.el' *** lisp/doc-view.el 2013-11-28 22:43:09 +0000 --- lisp/doc-view.el 2013-12-08 16:11:34 +0000 *************** *** 1870,1879 **** (let ((page (bookmark-prop-get bmk 'page))) (when (not (eq major-mode 'doc-view-mode)) (doc-view-toggle-display)) ! (with-selected-window ! (or (get-buffer-window (current-buffer) 0) ! (selected-window)) ! (doc-view-goto-page page))))) (provide 'doc-view) --- 1870,1882 ---- (let ((page (bookmark-prop-get bmk 'page))) (when (not (eq major-mode 'doc-view-mode)) (doc-view-toggle-display)) ! (run-with-idle-timer 0 nil ! (lambda (buffer page) ! (when (and (buffer-live-p buffer) ! (window-live-p (get-buffer-window buffer 0))) ! (with-selected-window (get-buffer-window buffer 0) ! (doc-view-goto-page page)))) ! (current-buffer) page)))) (provide 'doc-view) [-- Attachment #3: Backtrace --] [-- Type: application/octet-stream, Size: 4505 bytes --] Debugger entered--Lisp error: (wrong-type-argument listp t) image-mode-winprops(nil) image-mode-window-put(page 0 nil) (progn (image-mode-window-put (quote page) page nil) (image-mode-window-put (quote info) (concat (propertize (format "Page %d of %d." page len) (quote face) (quote bold)) (if doc-view--current-converter-processes " (still converting...)\n" "\n") (if (and doc-view--current-search-matches (assq page doc-view--current-search-matches)) (progn (concat (propertize "Search matches:\n" (quote face) (quote bold)) (let (...) (let ... ...) contexts))))) nil)) (let ((len (doc-view-last-page-number))) (if (< page 1) (setq page 1) (if (and (> page len) (null doc-view--current-converter-processes)) (progn (setq page len)))) (force-mode-line-update) (progn (image-mode-window-put (quote page) page nil) (image-mode-window-put (quote info) (concat (propertize (format "Page %d of %d." page len) (quote face) (quote bold)) (if doc-view--current-converter-processes " (still converting...)\n" "\n") (if (and doc-view--current-search-matches (assq page doc-view--current-search-matches)) (progn (concat (propertize "Search matches:\n" ... ...) (let ... ... contexts))))) nil)) (let ((file (expand-file-name (format doc-view--image-file-pattern page) (doc-view--current-cache-dir)))) (doc-view-insert-image file :pointer (quote arrow)) (if (and (not (file-exists-p file)) doc-view--current-converter-processes) (progn (funcall doc-view-single-page-converter-function doc-view--buffer-file-name file page (let ((win ...)) (function (lambda nil ...))))))) (overlay-put (image-mode-window-get (quote overlay)) (quote help-echo) (image-mode-window-get (quote info)))) doc-view-goto-page(1) (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page page)) (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page page)) (internal--after-with-selected-window save-selected-window--state)) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page page)) (internal--after-with-selected-window save-selected-window--state))) (let ((save-selected-window--state (internal--before-with-selected-window (or (get-buffer-window (current-buffer) 0) (selected-window))))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page page)) (internal--after-with-selected-window save-selected-window--state)))) (let ((page (bookmark-prop-get bmk (quote page)))) (if (not (eq major-mode (quote doc-view-mode))) (progn (doc-view-toggle-display))) (let ((save-selected-window--state (internal--before-with-selected-window (or (get-buffer-window (current-buffer) 0) (selected-window))))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page page)) (internal--after-with-selected-window save-selected-window--state))))) (prog1 (bookmark-default-handler bmk) (let ((page (bookmark-prop-get bmk (quote page)))) (if (not (eq major-mode (quote doc-view-mode))) (progn (doc-view-toggle-display))) (let ((save-selected-window--state (internal--before-with-selected-window (or (get-buffer-window ... 0) (selected-window))))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) (quote norecord)) (doc-view-goto-page page)) (internal--after-with-selected-window save-selected-window--state)))))) doc-view-bookmark-jump(("some.pdf" (filename . "/tmp/some.pdf") (front-context-string . "%PDF-1.3\n%\307\354\217\242\n5") (rear-context-string) (position . 1) (page . 1) (handler . doc-view-bookmark-jump))) funcall(doc-view-bookmark-jump ("some.pdf" (filename . "/tmp/some.pdf") (front-context-string . "%PDF-1.3\n%\307\354\217\242\n5") (rear-context-string) (position . 1) (page . 1) (handler . doc-view-bookmark-jump))) (condition-case err (funcall (or (bookmark-get-handler bookmark-name-or-record) (quote bookmark-default-handler)) (bookmark-get-bookmark bookmark-name-or-record)) (bookmark-error-no-filename (if (stringp bookmark-name-or-record) (progn (let ((file (bookmark-get-filename bookmark-name-or-record))) (if file (progn (let ... ... ...)))))))) bookmark-handle-bookmark("some.pdf") bookmark--jump-via("some.pdf" switch-to-buffer) bookmark-jump("some.pdf") call-interactively(bookmark-jump nil nil) command-execute(bookmark-jump) [-- Attachment #4: Type: text/plain, Size: 22675 bytes --] In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of 2013-11-23 on luca Bzr revision: 114436 politza@fh-trier.de-20131123014125-vrsnab4s0vsaw7w6 Windowing system distributor `The X.Org Foundation', version 11.0.10707000 System Description: Debian GNU/Linux 6.0.8 (squeeze) Configured using: `configure -C' Important settings: value of $LC_COLLATE: C value of $LC_MESSAGES: C value of $LANG: de_DE.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Dired -lAS Minor modes in effect: semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode) S))) ewm-mode-line-mode: t ewm-mode: t ewm-compat-mode: t ewm-compat-calendar-mode: t ewm-compat-calc-mode: t diff-auto-refine-mode: t TeX-source-correlate-mode: t global-semanticdb-minor-mode: t global-semantic-decoration-mode: t global-semantic-idle-scheduler-mode: t semantic-mode: t desktop-save-mode: t mimo-mode: t pc-completion-mode: t ispell-track-input-method: t doc-view-tidy-cache-mode: t recentf-mode: t show-paren-mode: t window-numbering-mode: t shell-dirtrack-mode: t scroll-other-window-mode: t savehist-mode: t eldoc-in-minibuffer-mode: t ekey-mode: t winner-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-b p a <return> M-n M-p C-c C-a C-p C-e <return> M-p C-c C-a C-l C-u C-c C-a C-p C-p C-p C-x o C-p C-p C-M-f C-M-b C-M-SPC M-w C-x o C-x C-q M-f M-f M-b M-f M-f C-; b n C-c C-a C-p C-e l i s p / C h <tab> <return> C-x o C-l C-SPC C-n C-n C-n C-n C-n C-w M-< C-y C-s d o c - v i <return> C-l C-s C-s C-s <return> C-l C-s C-s C-s C-g C-s d o c - v i e w - b o C-s <return> C-l M-< C-l C-/ C-x k <return> C-s C-g M-< C-x C-s C-x C-f d o c <tab> <return> C-x o M-n C-c C-a C-x o C-l C-x C-s C-u C-x v D <return> <return> C-x o C-u C-g C-x v C-g C-x C-v C-g C-x v D M-n M-p C-c C-c C-n C-n C-n C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-M-s C-q <tab> C-s C-s C-g C-x o C-M-a C-, L b o o k m <tab> <return> C-x v l C-s b o o k C-s C-s C-s C-s C-s C-s C-s <return> C-l C-s C-s C-s C-s C-s C-s C-s <return> C-l C-l C-s C-s <return> C-x o C-x b <return> C-x b d i f <return> C-x C-w / t m p / d o <tab> <return> y y C-x b d o C-s C-k C-g g C-x b d o c C-r C-g C-x C-j C-0 w C-x b <return> C-x b e x <return> C-x C-j C-u s S <return> M-> C-p C-p C-p C / t m p / f o o . p d f <return> M-x r e p o r <tab> b u g <return> Recent messages: Saving file /tmp/doc-view.patch... Wrote /tmp/doc-view.patch Quit Mark set Quit Directory has changed on disk; type g to update Dired /tmp/doc-view.patch Mark set Copy: 1 of 1 Copy: 1 file Load-path shadows: /home/politza/.emacs.d/elpa/yasnippet-20130907.1855/yasnippet hides /home/politza/.emacs.d/plugins/yasnippet-0.6.1c/yasnippet /home/politza/.emacs.d/plugins/tblc hides /home/politza/.emacs.d/plugins/tblc/tblc /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-sys hides /home/politza/.emacs.d/plugins/helm/helm-sys /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-locate hides /home/politza/.emacs.d/plugins/helm/helm-locate /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-org hides /home/politza/.emacs.d/plugins/helm/helm-org /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-ring hides /home/politza/.emacs.d/plugins/helm/helm-ring /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-imenu hides /home/politza/.emacs.d/plugins/helm/helm-imenu /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-config hides /home/politza/.emacs.d/plugins/helm/helm-config /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-bmkext hides /home/politza/.emacs.d/plugins/helm/helm-bmkext /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-w3m hides /home/politza/.emacs.d/plugins/helm/helm-w3m /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-elscreen hides /home/politza/.emacs.d/plugins/helm/helm-elscreen /home/politza/.emacs.d/elpa/helm-20130926.2236/helm hides /home/politza/.emacs.d/plugins/helm/helm /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-font hides /home/politza/.emacs.d/plugins/helm/helm-font /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-grep hides /home/politza/.emacs.d/plugins/helm/helm-grep /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-semantic hides /home/politza/.emacs.d/plugins/helm/helm-semantic /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-pkg hides /home/politza/.emacs.d/plugins/helm/helm-pkg /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-elisp hides /home/politza/.emacs.d/plugins/helm/helm-elisp /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-misc hides /home/politza/.emacs.d/plugins/helm/helm-misc /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-external hides /home/politza/.emacs.d/plugins/helm/helm-external /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-match-plugin hides /home/politza/.emacs.d/plugins/helm/helm-match-plugin /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-adaptative hides /home/politza/.emacs.d/plugins/helm/helm-adaptative /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-tags hides /home/politza/.emacs.d/plugins/helm/helm-tags /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-bbdb hides /home/politza/.emacs.d/plugins/helm/helm-bbdb /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-eval hides /home/politza/.emacs.d/plugins/helm/helm-eval /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-emms hides /home/politza/.emacs.d/plugins/helm/helm-emms /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-net hides /home/politza/.emacs.d/plugins/helm/helm-net /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-gentoo hides /home/politza/.emacs.d/plugins/helm/helm-gentoo /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-firefox hides /home/politza/.emacs.d/plugins/helm/helm-firefox /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-dabbrev hides /home/politza/.emacs.d/plugins/helm/helm-dabbrev /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-eshell hides /home/politza/.emacs.d/plugins/helm/helm-eshell /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-help hides /home/politza/.emacs.d/plugins/helm/helm-help /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-buffers hides /home/politza/.emacs.d/plugins/helm/helm-buffers /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-color hides /home/politza/.emacs.d/plugins/helm/helm-color /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-aliases hides /home/politza/.emacs.d/plugins/helm/helm-aliases /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-regexp hides /home/politza/.emacs.d/plugins/helm/helm-regexp /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-bookmark hides /home/politza/.emacs.d/plugins/helm/helm-bookmark /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-apt hides /home/politza/.emacs.d/plugins/helm/helm-apt /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-yaoddmuse hides /home/politza/.emacs.d/plugins/helm/helm-yaoddmuse /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-info hides /home/politza/.emacs.d/plugins/helm/helm-info /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-man hides /home/politza/.emacs.d/plugins/helm/helm-man /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-call-tree hides /home/politza/.emacs.d/plugins/helm/helm-call-tree /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-mode hides /home/politza/.emacs.d/plugins/helm/helm-mode /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-utils hides /home/politza/.emacs.d/plugins/helm/helm-utils /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-files hides /home/politza/.emacs.d/plugins/helm/helm-files /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-command hides /home/politza/.emacs.d/plugins/helm/helm-command /home/politza/.emacs.d/elpa/helm-20130926.2236/helm-plugin hides /home/politza/.emacs.d/plugins/helm/helm-plugin /home/politza/.emacs.d/plugins/haskell-mode/haskell-cabal hides /home/politza/.emacs.d/plugins/haskell/haskell-cabal /home/politza/.emacs.d/plugins/haskell-mode/haskell-decl-scan hides /home/politza/.emacs.d/plugins/haskell/haskell-decl-scan /home/politza/.emacs.d/plugins/haskell-mode/haskell-doc hides /home/politza/.emacs.d/plugins/haskell/haskell-doc /home/politza/.emacs.d/plugins/haskell-mode/ghc-core hides /home/politza/.emacs.d/plugins/haskell/ghc-core /home/politza/.emacs.d/plugins/haskell-mode/haskell-mode hides /home/politza/.emacs.d/plugins/haskell/haskell-mode /home/politza/.emacs.d/plugins/haskell-mode/haskell-c hides /home/politza/.emacs.d/plugins/haskell/haskell-c /home/politza/.emacs.d/plugins/haskell-mode/haskell-indentation hides /home/politza/.emacs.d/plugins/haskell/haskell-indentation /home/politza/.emacs.d/plugins/haskell-mode/haskell-site-file hides /home/politza/.emacs.d/plugins/haskell/haskell-site-file /home/politza/.emacs.d/plugins/haskell-mode/haskell-ghci hides /home/politza/.emacs.d/plugins/haskell/haskell-ghci /home/politza/.emacs.d/plugins/haskell-mode/inf-haskell hides /home/politza/.emacs.d/plugins/haskell/inf-haskell /home/politza/.emacs.d/plugins/haskell-mode/haskell-indent hides /home/politza/.emacs.d/plugins/haskell/haskell-indent /home/politza/.emacs.d/plugins/haskell-mode/haskell-hugs hides /home/politza/.emacs.d/plugins/haskell/haskell-hugs /home/politza/.emacs.d/plugins/haskell-mode/haskell-font-lock hides /home/politza/.emacs.d/plugins/haskell/haskell-font-lock /home/politza/.emacs.d/plugins/haskell-mode/haskell-simple-indent hides /home/politza/.emacs.d/plugins/haskell/haskell-simple-indent /home/politza/.emacs.d/plugins/jedi/scratch hides /home/politza/.emacs.d/plugins/ewm/scratch /home/politza/.emacs.d/elpa/company-20130923.513/.dir-locals hides /home/politza/.emacs.d/plugins/el-get/.dir-locals /home/politza/.emacs.d/elpa/pc-1.0/pc hides /home/politza/src/emacs/override-redirect/lisp/pc /home/politza/.emacs.d/elpa/popup-20130708.2245/popup hides /home/politza/src/emacs/override-redirect/lisp/popup /home/politza/.emacs.d/plugins/jedi/scratch hides /home/politza/src/emacs/override-redirect/lisp/scratch /home/politza/.emacs.d/plugins/saveplace hides /home/politza/src/emacs/override-redirect/lisp/saveplace /home/politza/.emacs.d/plugins/imenu hides /home/politza/src/emacs/override-redirect/lisp/imenu /home/politza/.emacs.d/plugins/term hides /home/politza/src/emacs/override-redirect/lisp/term /home/politza/.emacs.d/elpa/company-20130923.513/.dir-locals hides /home/politza/src/emacs/override-redirect/lisp/gnus/.dir-locals /home/politza/.emacs.d/plugins/matlab/matlab hides /usr/share/emacs-snapshot/site-lisp/emacs-goodies-el/matlab /home/politza/.emacs.d/plugins/boxquote hides /usr/share/emacs-snapshot/site-lisp/emacs-goodies-el/boxquote /home/politza/.emacs.d/plugins/bm hides /usr/share/emacs-snapshot/site-lisp/emacs-goodies-el/bm /home/politza/.emacs.d/plugins/haskell-mode/haskell-decl-scan hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-decl-scan /home/politza/.emacs.d/plugins/haskell-mode/haskell-c hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-c /home/politza/.emacs.d/plugins/haskell-mode/haskell-ghci hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-ghci /home/politza/.emacs.d/plugins/haskell-mode/haskell-doc hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-doc /home/politza/.emacs.d/plugins/haskell-mode/haskell-indent hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-indent /home/politza/.emacs.d/plugins/haskell-mode/haskell-mode hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-mode /home/politza/.emacs.d/plugins/haskell-mode/haskell-hugs hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-hugs /home/politza/.emacs.d/plugins/haskell-mode/haskell-site-file hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-site-file /home/politza/.emacs.d/plugins/haskell-mode/haskell-cabal hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-cabal /home/politza/.emacs.d/plugins/haskell-mode/inf-haskell hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/inf-haskell /home/politza/.emacs.d/plugins/haskell-mode/haskell-font-lock hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-font-lock /home/politza/.emacs.d/plugins/haskell-mode/haskell-simple-indent hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-simple-indent /home/politza/.emacs.d/plugins/haskell-mode/haskell-indentation hides /usr/share/emacs-snapshot/site-lisp/haskell-mode/haskell-indentation Features: (shadow sort gnus-cite bbdb-message mailalias mail-extr nnir nndraft nnmh bbdb-gnus gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache gnus-msg gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime dig mailcap emacsbug sendmail log-view log-edit pcvs-util smerge-mode vc-sccs vc-cvs vc-rcs bug-reference add-log whitespace semantic/ia semantic/analyze/refs semantic/senator bookmark cal-move mule-util pp reposition dired-aux misearch multi-isearch holidays hol-loaddefs diary-lib diary-loaddefs ewm ewm-compat ewm-conf ewm-frame ewm-util ewm-window diff-mode latexenc vc-dir ewoc vc preview prv-emacs reftex-dcr reftex-auc tex-buf font-latex vc-bzr vc-git doc-view-fixed-scroll pdf-sync pdf-annot tablist tablist-filter semantic/wisent/comp semantic/wisent semantic/wisent/wisent pdf-outline pdf-links pdf-isearch pdf-misc imenu pdf-info tq pdf-render pdf-history vc-dispatcher vc-svn semantic/db-file data-debug cedet-files cl-font-lock dired-eshell emacs-customizations hypermedia-customizations eww-customizations nogroup-customizations wp-customizations view-customizations tex-customizations reftex-customizations reftex-miscellaneous-configurations-customizations reftex-label-support-customizations reftex-referencing-labels-customizations reftex-defining-label-environments-customizations reftex reftex-vars AUCTeX-customizations preview-customizations preview-latex-customizations preview-appearance-customizations font-latex-customizations TeX-parse-customizations TeX-file-customizations TeX-command-customizations TeX-view-customizations LaTeX-customizations LaTeX-macro-customizations LaTeX-math-customizations LaTeX-indentation-customizations latex tex-style tex dbus xml table-customizations table-hooks-customizations outlines-customizations programming-customizations rnc-customizations tools-customizations vc-customizations log-edit-customizations semantic-customizations pulse-customizations semantic-imenu-customizations semantic/db-mode semantic/decorate/mode semantic/decorate pulse makefile-customizations etags-customizations ediff-customizations diff-customizations diff-mode-customizations languages-customizations elpy-customizations matlab-customizations sh-customizations python-customizations nxml-customizations relax-ng-customizations haskell-customizations c-customizations semantic/bovine/c hideif cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs semantic/db-find semantic/db-ref semantic/bovine/c-by semantic/lex-spp semantic/idle semantic/bovine/gcc semantic/dep semantic/bovine semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn semantic/db eieio-base semantic/ctxt semantic/format ezimage semantic/tag-ls semantic/find semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local cedet asm-customizations multimedia-customizations image-customizations pcase help-customizations ekey-customizations info-lookup-customizations info-customizations customize-customizations custom-buffer-customizations apropos-customizations help-mode files-customizations uniquify-customizations uniquify sunrise-customizations recentf-customizations lib-files find-file-customizations backup-customizations faces-customizations highlight-symbol-customizations font-lock-customizations hi-lock-customizations facemenu-customizations external-customizations server-customizations processes-customizations shell-customizations proced-customizations gud-customizations tooltip-customizations grep-customizations compilation-customizations next-error-customizations comint-customizations SQL-customizations man-customizations environment-customizations xterm-customizations windows-customizations winner-customizations minibuffer-customizations savehist-customizations completion-spelling lib-string menu-customizations keyboard-customizations chistory-customizations initialization-customizations frames-customizations ediff-window-customizations desktop-customizations desktop frameset dired-customizations dired-x-customizations dired-x dired-details-customizations editing-customizations paragraphs-customizations matching-customizations paren-matching-customizations paren-showing-customizations isearch-customizations bookmark-customizations killing-customizations indent-customizations fill-customizations comment-customizations emulations-customizations editing-basics-customizations development-customizations lisp-customizations re-builder-customizations inferior-lisp-customizations ielm-customizations ert-customizations edebug-customizations bytecomp-customizations advice-customizations internal-customizations alloc-customizations extensions-customizations widgets-customizations eldoc-customizations eldoc-eval-customizations cust-print-customizations data-customizations save-place-customizations convenience-customizations mimo-customizations mimo diminish-customizations diminish iedit-customizations imenu-tree-customizations tags-tree-customizations company-customizations workgroups-customizations window-numbering-customizations pabbrev-customizations kmacro-customizations imenu-customizations ibuffer-customizations ibuf-macs hl-line-customizations hippie-expand-customizations file-cache-customizations ffap-customizations completion-customizations pc-completion-customizations jedi-customizations iswitchb-customizations auto-complete-customizations pc switch-focus color hl-line browse-kill-ring-customizations auto-revert-customizations auto-insert-customizations Buffer-menu-customizations comm-customizations tramp-customizations browse-url-customizations applications-customizations mediawiki-customizations w3m-customizations package-customizations mail-customizations bbdb-customizations bbdb-sendmail-customizations bbdb-mua-customizations bbdb-mua bbdb-com crm bbdb smtpmail-customizations shr-customizations sendmail-customizations gnus-customizations nnmail-customizations nnmail-split-customizations mail-source-customizations gnus-summary-customizations gnus-thread-customizations gnus-summary-various-customizations gnus-summary-sort-customizations gnus-summary-marks-customizations gnus-summary-maneuvering-customizations gnus-summary-format-customizations parse-time-rfc2822 gnus-summary-exit-customizations gnus-sum gnus-group gnus-undo gnus-start gnus-spec gnus-win gnus-start-customizations gnus-server-customizations gnus-message-customizations message-customizations message-various-customizations message-sending-customizations message-buffers-customizations gnus-group-customizations gnus-group-visual-customizations gnus-nnimap-format nnimap nnmail gnus-int mail-source message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader parse-time tls utf7 netrc nnoo gnus gnus-ems nnheader mail-utils gnus-group-various-customizations gnus-group-select-customizations gnus-files-customizations gnus-newsrc-customizations gnus-exit-customizations gnus-article-customizations gnus-article-hiding-customizations ispell-customizations eshell-customizations eshell-module-customizations eshell-smart-customizations eshell-hist-customizations eshell-mode-customizations edebug doc-view-customizations pdf-tools-customizations pdf-sync-customizations pdf-annot-customizations pdf-isearch-customizations pdf-tools pdf-util gnus-range warnings doc-view-tidy-cache doc-view jka-compr image-mode calendar-customizations org-customizations org-structure-customizations org-plain-lists-customizations org-edit-structure-customizations org-startup-customizations org-link-customizations org-latex-customizations org-appearance-customizations holidays-customizations diary-customizations calculator-customizations calc-customizations server tramp-cache tramp-sh recentf tree-widget .autoload paren window-numbering w3m browse-url timezone w3m-hist w3m-e23 w3m-ccl ccl w3m-fsf w3m-favicon w3m-image w3m-proc w3m-util tramp tramp-compat tramp-loaddefs trampver shell track-last-window scroll-other-window saveplace savehist pabbrev derived cl-macs gv org org-macro org-footnote org-pcomplete org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs lib-edit hsqldb sql view lib-window lib-isearch lib-buffer reveal iswitchb lib-basic lib-lispext info-look ibuffer hippie-exp grep compile filecache edit-minibuffer eldoc-eval pcomplete esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util ekey assoc dired-details+ dired dired-details cool-prefix-bindings winner edmacro kmacro lib-kbd comint-history comint ansi-color ring browse-kill-ring advice anticus apropos ffap thingatpt url-parse auth-source eieio byte-opt bytecomp byte-compile cconv eieio-core gnus-util mm-util mail-prsvr password-cache url-vars eldoc help-fns cus-edit cus-start cus-load wid-edit cl cl-loaddefs cl-lib bbdb-loaddefs info easymenu tex-site cl-format-autoloads package time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-08 16:54 bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark Andreas Politz @ 2013-12-09 9:13 ` Tassilo Horn 2013-12-09 12:33 ` Andreas Politz 2013-12-09 16:55 ` Glenn Morris 2013-12-10 2:51 ` Stefan Monnier 2013-12-20 8:00 ` Tassilo Horn 2 siblings, 2 replies; 26+ messages in thread From: Tassilo Horn @ 2013-12-09 9:13 UTC (permalink / raw) To: Andreas Politz; +Cc: 16090 Andreas Politz <politza@hochschule-trier.de> writes: > $ emacs -Q some.pdf > > C-x r m RET > C-x k RET > C-x r b some.pdf RET > > Debugger entered--Lisp error: (wrong-type-argument listp t) > image-mode-winprops(nil) Indeed. > The reason is that the buffer is not yet displayed, when > doc-view-bookmark-jump tries to change the page. This results in, for > obscure reasons, trying to change the page in which ever window is > currently selected. Solution: Defer changing the page after > bookmark--jump-via has displayed the page. Here's a simpler patch which does also seem to fix the problem by simply using find-file instead of bookmark's default handler without requiring a timer. --8<---------------cut here---------------start------------->8--- === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2013-01-01 09:11:05 +0000 +++ lisp/doc-view.el 2013-12-09 08:55:30 +0000 @@ -1653,14 +1653,11 @@ (defun doc-view-bookmark-jump (bmk) ;; This implements the `handler' function interface for record type ;; returned by `doc-view-bookmark-make-record', which see. - (prog1 (bookmark-default-handler bmk) + (prog1 (find-file (bookmark-get-filename bmk)) (let ((page (bookmark-prop-get bmk 'page))) (when (not (eq major-mode 'doc-view-mode)) - (doc-view-toggle-display)) - (with-selected-window - (or (get-buffer-window (current-buffer) 0) - (selected-window)) - (doc-view-goto-page page))))) + (doc-view-toggle-display)) + (doc-view-goto-page page)))) --8<---------------cut here---------------end--------------->8--- Could you check if that also fixes the issue for you? And a question concerning the procedure: since this is a fix for a bug relative to emacs 23, should I commit it on the emacs-24 branch? Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-09 9:13 ` Tassilo Horn @ 2013-12-09 12:33 ` Andreas Politz 2013-12-09 14:56 ` Tassilo Horn 2013-12-09 16:55 ` Glenn Morris 1 sibling, 1 reply; 26+ messages in thread From: Andreas Politz @ 2013-12-09 12:33 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090 Tassilo Horn <tsdh@gnu.org> writes: > Here's a simpler patch which does also seem to fix the problem by simply > using find-file instead of bookmark's default handler without requiring > a timer. The timer surely is ugly. But the code displaying the buffer runs after the handler returns and using find-file in it may result in displaying the buffer twice, I guess. E.g. when using bookmark-jump-other-window. -ap ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-09 12:33 ` Andreas Politz @ 2013-12-09 14:56 ` Tassilo Horn 0 siblings, 0 replies; 26+ messages in thread From: Tassilo Horn @ 2013-12-09 14:56 UTC (permalink / raw) To: Andreas Politz; +Cc: 16090 Andreas Politz <politza@hochschule-trier.de> writes: >> Here's a simpler patch which does also seem to fix the problem by >> simply using find-file instead of bookmark's default handler without >> requiring a timer. > > The timer surely is ugly. But the code displaying the buffer runs after > the handler returns and using find-file in it may result in displaying > the buffer twice, I guess. E.g. when using bookmark-jump-other-window. Indeed, you are right. Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-09 9:13 ` Tassilo Horn 2013-12-09 12:33 ` Andreas Politz @ 2013-12-09 16:55 ` Glenn Morris 2013-12-10 7:28 ` Tassilo Horn 1 sibling, 1 reply; 26+ messages in thread From: Glenn Morris @ 2013-12-09 16:55 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090, Andreas Politz Tassilo Horn wrote: > And a question concerning the procedure: since this is a fix for a bug > relative to emacs 23, should I commit it on the emacs-24 branch? If you want to do that and are sure the fix is correct, go ahead. But feel equally free to just commit to trunk instead, since that emacs-24 branch will not be used for any more releases. ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-09 16:55 ` Glenn Morris @ 2013-12-10 7:28 ` Tassilo Horn 0 siblings, 0 replies; 26+ messages in thread From: Tassilo Horn @ 2013-12-10 7:28 UTC (permalink / raw) To: Glenn Morris; +Cc: 16090, Andreas Politz Glenn Morris <rgm@gnu.org> writes: >> And a question concerning the procedure: since this is a fix for a >> bug relative to emacs 23, should I commit it on the emacs-24 branch? > > If you want to do that and are sure the fix is correct, go ahead. But > feel equally free to just commit to trunk instead, since that emacs-24 > branch will not be used for any more releases. Ah, ok. I've thought 24.4 would be made from the emacs-24 branch, and then I'd definitively like to have the fix in there. Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-08 16:54 bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark Andreas Politz 2013-12-09 9:13 ` Tassilo Horn @ 2013-12-10 2:51 ` Stefan Monnier 2013-12-10 7:53 ` Tassilo Horn 2013-12-20 8:00 ` Tassilo Horn 2 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2013-12-10 2:51 UTC (permalink / raw) To: Andreas Politz; +Cc: 16090 > The reason is that the buffer is not yet displayed, when > doc-view-bookmark-jump tries to change the page. This results in, for > obscure reasons, trying to change the page in which ever window is > currently selected. Solution: Defer changing the page after > bookmark--jump-via has displayed the page. Thanks for the report. And thanks for the patch, tho it shouldn't be installed as is: using a timer is not a good solution. The code is already equipped to handle non-displayed buffers (it keeps track of the "default current page" which is later used when/if the buffer gets displayed in a window). Apparently, there's a bug in that code, or a bad interaction with that code and something that happens when you use a bookmark to access the document. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-10 2:51 ` Stefan Monnier @ 2013-12-10 7:53 ` Tassilo Horn 2013-12-10 10:02 ` Andreas Politz ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Tassilo Horn @ 2013-12-10 7:53 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16090, Andreas Politz Stefan Monnier <monnier@IRO.UMontreal.CA> writes: >> The reason is that the buffer is not yet displayed, when >> doc-view-bookmark-jump tries to change the page. This results in, >> for obscure reasons, trying to change the page in which ever window >> is currently selected. Solution: Defer changing the page after >> bookmark--jump-via has displayed the page. > > Thanks for the report. And thanks for the patch, tho it shouldn't be > installed as is: using a timer is not a good solution. The code is > already equipped to handle non-displayed buffers (it keeps track of > the "default current page" which is later used when/if the buffer gets > displayed in a window). Yes, but I think that doesn't suffice. The problem with bookmarks is that the display window function is run after the bookmark handler, so we have no clue in which window the bookmarked page is going to be shown. It may be the current window, an existing other window (which might already show another page of the doc and thus already has an entry in `image-mode-winprops-alist'), or a completely new window. Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-10 7:53 ` Tassilo Horn @ 2013-12-10 10:02 ` Andreas Politz 2013-12-10 11:58 ` Andreas Politz 2013-12-10 16:56 ` Andreas Politz 2013-12-11 4:43 ` Stefan Monnier 2 siblings, 1 reply; 26+ messages in thread From: Andreas Politz @ 2013-12-10 10:02 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090 Tassilo Horn <tsdh@gnu.org> writes: > Stefan Monnier <monnier@IRO.UMontreal.CA> writes: >> The code is already equipped to handle non-displayed buffers (it >> keeps track of the "default current page" which is later used when/if >> the buffer gets displayed in a window). I see. So the problem is the (with-selected-window (or ... (selected-window))), which most of the times makes the wrong buffer current (having image-mode-winprops-alist eq t). > > Yes, but I think that doesn't suffice. The problem with bookmarks is > that the display window function is run after the bookmark handler, so > we have no clue in which window the bookmarked page is going to be > shown. [...] What about setting an additional property for the page in image-mode-winprops-alist and removing it later in doc-view-new-window-function ? -ap ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-10 10:02 ` Andreas Politz @ 2013-12-10 11:58 ` Andreas Politz 0 siblings, 0 replies; 26+ messages in thread From: Andreas Politz @ 2013-12-10 11:58 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090 Andreas Politz <politza@hochschule-trier.de> writes: > What about setting an additional property [...] Never mind this shot from the hip. -ap ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-10 7:53 ` Tassilo Horn 2013-12-10 10:02 ` Andreas Politz @ 2013-12-10 16:56 ` Andreas Politz 2013-12-10 20:07 ` Tassilo Horn 2013-12-11 4:43 ` Stefan Monnier 2 siblings, 1 reply; 26+ messages in thread From: Andreas Politz @ 2013-12-10 16:56 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090 Tassilo Horn <tsdh@gnu.org> writes: > Stefan Monnier <monnier@IRO.UMontreal.CA> writes: > >> The code is already equipped to handle non-displayed buffers (it >> keeps track of the "default current page" which is later used when/if >> the buffer gets displayed in a window). Where is this page read and gone to ? doc-view-new-window-function at most switches to the first page and this (with-current-buffer (find-file-noselect "some.pdf") (doc-view-goto-page 2) (pop-to-buffer (current-buffer))) also displays the first page. Is this a mistake in this function, i.e. shouldn't it read the winprop page ? -ap ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-10 16:56 ` Andreas Politz @ 2013-12-10 20:07 ` Tassilo Horn 2013-12-10 22:16 ` Andreas Politz 0 siblings, 1 reply; 26+ messages in thread From: Tassilo Horn @ 2013-12-10 20:07 UTC (permalink / raw) To: Andreas Politz; +Cc: 16090 Andreas Politz <politza@hochschule-trier.de> writes: >>> The code is already equipped to handle non-displayed buffers (it >>> keeps track of the "default current page" which is later used >>> when/if the buffer gets displayed in a window). > > Where is this page read and gone to ? doc-view-new-window-function at > most switches to the first page Comment in the `message' in the first line. You'll see that it's called two times (once with t and once with a window in (car winprops)) if the buffer hasn't been shown in some window already. > and this > > (with-current-buffer (find-file-noselect "some.pdf") > (doc-view-goto-page 2) > (pop-to-buffer (current-buffer))) > > also displays the first page. No, if some.pdf hasn't been open yet, it'll show page 2. In that case, `image-mode-winprops-alist' default entry will look like this: (t (info . #("Page 2 of 6.\n" 0 12 (face bold))) (page . 2) (overlay . #<overlay in no buffer>)) > Is this a mistake in this function, i.e. shouldn't it read the winprop > page? That happens during the second time the function is called with a real window by making the overlay showing the image with that window's page visible. Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-10 20:07 ` Tassilo Horn @ 2013-12-10 22:16 ` Andreas Politz 0 siblings, 0 replies; 26+ messages in thread From: Andreas Politz @ 2013-12-10 22:16 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090 Tassilo Horn <tsdh@gnu.org> writes: > Andreas Politz <politza@hochschule-trier.de> writes: >> and this >> >> (with-current-buffer (find-file-noselect "some.pdf") >> (doc-view-goto-page 2) >> (pop-to-buffer (current-buffer))) >> >> also displays the first page. > > No, if some.pdf hasn't been open yet, it'll show page 2. [...] >> [...] shouldn't it read the winprop page? > > That happens during the second time the function is called with a real > window by making the overlay showing the image with that window's page > visible. I am using a non-temporary cache directory and this makes a difference. If the document is not yet converted when opening it, it works as you said. But if it is, the code which would insert the image after the conversion never runs and the winprops for the popped up window look like this: (#<window 24 on some.pdf> (info . #("Page 2 of 4.\n" 0 12 (face bold))) (page . 2) (overlay . #<overlay in no buffer>)) ,with overlay properties (shortened) (help-echo "Page 2 of 4." display "Welcome to DocView! ..." window t doc-view t) Then the last sexp in doc-view-new-window-function switches to the first page, without using the page property. -ap ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-10 7:53 ` Tassilo Horn 2013-12-10 10:02 ` Andreas Politz 2013-12-10 16:56 ` Andreas Politz @ 2013-12-11 4:43 ` Stefan Monnier 2013-12-11 19:08 ` Tassilo Horn 2 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2013-12-11 4:43 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090, Andreas Politz > Yes, but I think that doesn't suffice. The problem with bookmarks is > that the display window function is run after the bookmark handler, so > we have no clue in which window the bookmarked page is going to be > shown. It may be the current window, an existing other window (which > might already show another page of the doc and thus already has an entry > in `image-mode-winprops-alist'), or a completely new window. Why does it matter? Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-11 4:43 ` Stefan Monnier @ 2013-12-11 19:08 ` Tassilo Horn 0 siblings, 0 replies; 26+ messages in thread From: Tassilo Horn @ 2013-12-11 19:08 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16090, Andreas Politz Stefan Monnier <monnier@IRO.UMontreal.CA> writes: >> Yes, but I think that doesn't suffice. The problem with bookmarks is >> that the display window function is run after the bookmark handler, >> so we have no clue in which window the bookmarked page is going to be >> shown. It may be the current window, an existing other window (which >> might already show another page of the doc and thus already has an >> entry in `image-mode-winprops-alist'), or a completely new window. > > Why does it matter? Please correct me if I'm wrong in the following. The winprops alist contains for a doc-view buffer the shown page for any window where the buffer has been shown plus a default entry that's used when the doc-view buffer is going to be shown in a new window. Let's assume I open foo.pdf with find-file and a single window. The default entry will get page 1 assigned and when it gets shown in a window, a new winprops entry for that window is created, also with page 1. Now I switch to page 2, then split and switch to page 3 in the new window, so my layout is as follows (* = selected window): | Window 1 (P2) | *Window 2 (P3) | Let's assume I have a bookmark on page 4 in foo.pdf. Then a) bookmark-jump should change the page in window 2 b) bookmark-jump-other-window should change the page in window 1 However, both first call `doc-view-bookmark-jump' and thereafter either `switch-to-buffer' or `pop-to-buffer'. How could the doc-view bookmark handler cope with this situation? Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-08 16:54 bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark Andreas Politz 2013-12-09 9:13 ` Tassilo Horn 2013-12-10 2:51 ` Stefan Monnier @ 2013-12-20 8:00 ` Tassilo Horn 2013-12-20 8:28 ` Andreas Politz 2013-12-20 14:33 ` Stefan Monnier 2 siblings, 2 replies; 26+ messages in thread From: Tassilo Horn @ 2013-12-20 8:00 UTC (permalink / raw) To: Andreas Politz, Stefan Monnier; +Cc: 16090 Andreas Politz <politza@hochschule-trier.de> writes: > (let ((page (bookmark-prop-get bmk 'page))) > (when (not (eq major-mode 'doc-view-mode)) > (doc-view-toggle-display)) > ! (run-with-idle-timer 0 nil > ! (lambda (buffer page) > ! (when (and (buffer-live-p buffer) > ! (window-live-p (get-buffer-window buffer 0))) > ! (with-selected-window (get-buffer-window buffer 0) > ! (doc-view-goto-page page)))) > ! (current-buffer) page)))) I just want to mention that even this timer-version acts wrongly when the display-func of `bookmark-jump' doesn't select the window, because `get-buffer-window' prefers the selected window. I don't think that's too much an issue, though, because the provided interactive bookmark functions use as display-functions only pop- and switch-to-buffer which will select the window, and then the patch works fine. So I'm in favor of committing the patch [before 24.4 is released!] cause in any case it's better than not being able to open bookmarks to document files altogether. The only cleaner way to get it right (I can see) was to change bookmark.el so that it determines/creates the window to show the buffer before calling the bookmark handler. But that's a much larger change possibly affecting many people that have their own bookmark-jump functions. Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-20 8:00 ` Tassilo Horn @ 2013-12-20 8:28 ` Andreas Politz 2013-12-20 13:02 ` Tassilo Horn 2013-12-20 14:33 ` Stefan Monnier 1 sibling, 1 reply; 26+ messages in thread From: Andreas Politz @ 2013-12-20 8:28 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090 Do you acknowledge and have an opinion on the cached vs. non-cached behaviour I did mention earlier ? -ap ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-20 8:28 ` Andreas Politz @ 2013-12-20 13:02 ` Tassilo Horn 2014-04-02 14:43 ` Stefan Monnier 0 siblings, 1 reply; 26+ messages in thread From: Tassilo Horn @ 2013-12-20 13:02 UTC (permalink / raw) To: Andreas Politz; +Cc: 16090 Andreas Politz <politza@hochschule-trier.de> writes: > Do you acknowledge and have an opinion on the cached vs. non-cached > behaviour I did mention earlier ? No, I haven't looked into the differences yet. But I think I've come up with a quite good solution for the general problem right now. The patch below allows bookmark handlers to return a function that accepts the window showing the buffer and then may act on it. When the display-function has been run, that function is called and in the doc-view case sets the page for that window. Until now, return values of handlers where simply ignored. It shouldn't break existing handlers, except if there's some handler that does something like (setq dunno (lambda (...) ...)) or (add-hook 'dunno-hook (lambda (...) ...)) as last expression which seems unlikely. I've grepped the emacs source code and at least all handlers in there (man, woman, image-mode, gnus, help, Info) don't do so. I've tested it with bookmarks to docs that had to be converted anew and bookmarks to docs that were already cached, and it seems to DTRT in all cases. --8<---------------cut here---------------start------------->8--- === modified file 'lisp/bookmark.el' --- lisp/bookmark.el 2013-09-11 03:31:56 +0000 +++ lisp/bookmark.el 2013-12-20 13:01:29 +0000 @@ -997,12 +997,18 @@ After calling DISPLAY-FUNCTION, set window point to the point specified by BOOKMARK-NAME-OR-RECORD, if necessary, run `bookmark-after-jump-hook', -and then show any annotations for this bookmark." - (bookmark-handle-bookmark bookmark-name-or-record) +and then show any annotations for this bookmark. + +If the handler returns a function, this function will be called +with the window showing the bookmark buffer." + (let ((win-fn (bookmark-handle-bookmark bookmark-name-or-record))) (save-current-buffer (funcall display-function (current-buffer))) (let ((win (get-buffer-window (current-buffer) 0))) - (if win (set-window-point win (point)))) + (when win + (set-window-point win (point)) + (when (functionp win-fn) + (funcall win-fn win))))) ;; FIXME: we used to only run bookmark-after-jump-hook in ;; `bookmark-jump' itself, but in none of the other commands. (run-hooks 'bookmark-after-jump-hook) @@ -1061,13 +1067,16 @@ (cons (current-buffer) (point)))) (defun bookmark-handle-bookmark (bookmark-name-or-record) - "Call BOOKMARK-NAME-OR-RECORD's handler or `bookmark-default-handler' -if it has none. This changes current buffer and point and returns nil, -or signals a `file-error'. + "Call BOOKMARK-NAME-OR-RECORD's handler or +`bookmark-default-handler' if it has none. This changes current +buffer and point, or signals a `file-error'. The handler may +return a function with one argument, a window. This function +will be called with the window showing the bookmark's buffer. If BOOKMARK-NAME-OR-RECORD has no file, this is a no-op. If BOOKMARK-NAME-OR-RECORD has a file, but that file no longer exists, then offer interactively to relocate BOOKMARK-NAME-OR-RECORD." + (prog1 (condition-case err (funcall (or (bookmark-get-handler bookmark-name-or-record) 'bookmark-default-handler) @@ -1106,8 +1115,7 @@ (signal (car err) (cdr err)))))))))) ;; Added by db. (when (stringp bookmark-name-or-record) - (setq bookmark-current-bookmark bookmark-name-or-record)) - nil) + (setq bookmark-current-bookmark bookmark-name-or-record)))) (define-error 'bookmark-errors nil) (define-error 'bookmark-error-no-filename === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2013-11-28 22:43:09 +0000 +++ lisp/doc-view.el 2013-12-20 12:30:55 +0000 @@ -1866,13 +1866,12 @@ (defun doc-view-bookmark-jump (bmk) ;; This implements the `handler' function interface for record type ;; returned by `doc-view-bookmark-make-record', which see. - (prog1 (bookmark-default-handler bmk) + (bookmark-default-handler bmk) (let ((page (bookmark-prop-get bmk 'page))) + (lambda (win) (when (not (eq major-mode 'doc-view-mode)) (doc-view-toggle-display)) - (with-selected-window - (or (get-buffer-window (current-buffer) 0) - (selected-window)) + (with-selected-window win (doc-view-goto-page page))))) --8<---------------cut here---------------end--------------->8--- Good to commit? Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-20 13:02 ` Tassilo Horn @ 2014-04-02 14:43 ` Stefan Monnier 2014-04-04 13:43 ` Tassilo Horn 0 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2014-04-02 14:43 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090, Andreas Politz > No, I haven't looked into the differences yet. But I think I've come up > with a quite good solution for the general problem right now. The patch > below allows bookmark handlers to return a function that accepts the > window showing the buffer and then may act on it. When the > display-function has been run, that function is called and in the > doc-view case sets the page for that window. Sounds good. > Until now, return values of handlers where simply ignored. It shouldn't > break existing handlers, except if there's some handler that does > something like If we're worried about such corner cases, we can do the same we do with completion-boundaries and completion-metadata: require that the function return (post-display-function . FUN) instead of just FUN. The probability that some pre-existing bookmark handler returns something of the form (post-display-function . FUN) is sufficiently small. Another option is to use a new bookmark property `post-display-function'. > I've tested it with bookmarks to docs that had to be converted anew and > bookmarks to docs that were already cached, and it seems to DTRT in all > cases. I think the current behavior in the "already cached" case demonstrates that we have a bug in there and I'm not sure that your patch fixes that bug (i.e. maybe it just works around it). I don't have time to dig into it, sadly. For emacs-24, your patch is too intrusive, so I think a patch along the lines of Andreas's might be acceptable, but it should use bookmark-after-jump-hook instead of using a timer. As for trunk, your patch is mostly OK. I think it should be pushed a bit further, tho: make it so that `display-function' returns the window (and fall back on calling get-buffer-window), and make it so that win-fn *replaces* the set-window-point (and receives the bookmark as additional argument, since it's likely that the function may like to use data from the bookmark, such as the page). After all, this get-buffer-window + set-window-point thingy in bookmark--jump-via is a hack to try and solve the same problem we're having (tho for "point in normal buffers", instead of for "current page in doc-view buffers"). Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2014-04-02 14:43 ` Stefan Monnier @ 2014-04-04 13:43 ` Tassilo Horn 2014-04-04 15:14 ` Stefan Monnier 0 siblings, 1 reply; 26+ messages in thread From: Tassilo Horn @ 2014-04-04 13:43 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16090, Andreas Politz Stefan Monnier <monnier@IRO.UMontreal.CA> writes: > For emacs-24, your patch is too intrusive, so I think a patch along > the lines of Andreas's might be acceptable, but it should use > bookmark-after-jump-hook instead of using a timer. Like so? (defun doc-view-bookmark-jump (bmk) ;; This implements the `handler' function interface for record type ;; returned by `doc-view-bookmark-make-record', which see. (let ((page (bookmark-prop-get bmk 'page))) (add-hook 'bookmark-after-jump-hook (lambda () (setq bookmark-after-jump-hook (cdr bookmark-after-jump-hook)) (when (not (eq major-mode 'doc-view-mode)) (doc-view-toggle-display)) (with-selected-window (or (get-buffer-window (current-buffer) 0) (selected-window)) (doc-view-goto-page page)))) (bookmark-default-handler bmk))) Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2014-04-04 13:43 ` Tassilo Horn @ 2014-04-04 15:14 ` Stefan Monnier 2014-04-04 15:53 ` Tassilo Horn 0 siblings, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2014-04-04 15:14 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090, Andreas Politz >> For emacs-24, your patch is too intrusive, so I think a patch along >> the lines of Andreas's might be acceptable, but it should use >> bookmark-after-jump-hook instead of using a timer. > Like so? Almost: > (defun doc-view-bookmark-jump (bmk) > ;; This implements the `handler' function interface for record type > ;; returned by `doc-view-bookmark-make-record', which see. > (let ((page (bookmark-prop-get bmk 'page))) > (add-hook 'bookmark-after-jump-hook > (lambda () > (setq bookmark-after-jump-hook > (cdr bookmark-after-jump-hook)) Don't use `setq' on hooks. Use remove-hook. Yes I know it's more complicated, you'll have to use `make-symbol' and fset it with the above lambda. But `setq' on hooks really is much too brittle. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2014-04-04 15:14 ` Stefan Monnier @ 2014-04-04 15:53 ` Tassilo Horn 2014-04-04 16:04 ` Glenn Morris 0 siblings, 1 reply; 26+ messages in thread From: Tassilo Horn @ 2014-04-04 15:53 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16090, Andreas Politz Stefan Monnier <monnier@iro.umontreal.ca> writes: >> (defun doc-view-bookmark-jump (bmk) >> ;; This implements the `handler' function interface for record type >> ;; returned by `doc-view-bookmark-make-record', which see. >> (let ((page (bookmark-prop-get bmk 'page))) >> (add-hook 'bookmark-after-jump-hook >> (lambda () >> (setq bookmark-after-jump-hook >> (cdr bookmark-after-jump-hook)) > > Don't use `setq' on hooks. Use remove-hook. Yes I know it's more > complicated, you'll have to use `make-symbol' and fset it with the > above lambda. But `setq' on hooks really is much too brittle. I knew it wasn't a good idea, but I didn't think of fset-ing an uninterned symbol. Good idea! Hm, but somehow I cannot commit with vc. I always get bzr: ERROR: Unrecognized bug debbugs:16090. Commit refused. But that's the right number! Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2014-04-04 15:53 ` Tassilo Horn @ 2014-04-04 16:04 ` Glenn Morris 2014-04-04 17:44 ` Tassilo Horn 0 siblings, 1 reply; 26+ messages in thread From: Glenn Morris @ 2014-04-04 16:04 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090, Andreas Politz Tassilo Horn wrote: > Hm, but somehow I cannot commit with vc. I always get > > bzr: ERROR: Unrecognized bug debbugs:16090. Commit refused. Thanks to Emacs's .dir-locals.el, you MUST add an entry to your ~/.bazaar/bazaar.conf of the form: [DEFAULT] bugtracker_debbugs_url = http://debbugs.gnu.org/{id} Else you get this confusing error when you try to commit something with a Fixes: field. ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2014-04-04 16:04 ` Glenn Morris @ 2014-04-04 17:44 ` Tassilo Horn 0 siblings, 0 replies; 26+ messages in thread From: Tassilo Horn @ 2014-04-04 17:44 UTC (permalink / raw) To: Glenn Morris; +Cc: 16090-close, Andreas Politz Glenn Morris <rgm@gnu.org> writes: Hi Glenn, >> Hm, but somehow I cannot commit with vc. I always get >> >> bzr: ERROR: Unrecognized bug debbugs:16090. Commit refused. > > Thanks to Emacs's .dir-locals.el, you MUST add an entry to > your ~/.bazaar/bazaar.conf of the form: > > [DEFAULT] > bugtracker_debbugs_url = http://debbugs.gnu.org/{id} > > Else you get this confusing error when you try to commit something > with a Fixes: field. Ah, that did the trick. Ok, the change is committed on the emacs-24 branch. Thanks, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-20 8:00 ` Tassilo Horn 2013-12-20 8:28 ` Andreas Politz @ 2013-12-20 14:33 ` Stefan Monnier 2013-12-20 14:36 ` Tassilo Horn 1 sibling, 1 reply; 26+ messages in thread From: Stefan Monnier @ 2013-12-20 14:33 UTC (permalink / raw) To: Tassilo Horn; +Cc: 16090, Andreas Politz > So I'm in favor of committing the patch [before 24.4 is released!] cause > in any case it's better than not being able to open bookmarks to > document files altogether. There's still a lot of time before 24.4 is released, so there's no hurry in this respect. I'd like to first understand the underlying problem better. Stefan ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark 2013-12-20 14:33 ` Stefan Monnier @ 2013-12-20 14:36 ` Tassilo Horn 0 siblings, 0 replies; 26+ messages in thread From: Tassilo Horn @ 2013-12-20 14:36 UTC (permalink / raw) To: Stefan Monnier; +Cc: 16090, Andreas Politz Stefan Monnier <monnier@IRO.UMontreal.CA> writes: >> So I'm in favor of committing the patch [before 24.4 is released!] >> cause in any case it's better than not being able to open bookmarks >> to document files altogether. > > There's still a lot of time before 24.4 is released, so there's no > hurry in this respect. Sure, we just should not forget about it. And have a look at my other patch to bookmark.el & doc-view.el. I think that's a good fix for the issue. Bye, Tassilo ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2014-04-04 17:44 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-12-08 16:54 bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark Andreas Politz 2013-12-09 9:13 ` Tassilo Horn 2013-12-09 12:33 ` Andreas Politz 2013-12-09 14:56 ` Tassilo Horn 2013-12-09 16:55 ` Glenn Morris 2013-12-10 7:28 ` Tassilo Horn 2013-12-10 2:51 ` Stefan Monnier 2013-12-10 7:53 ` Tassilo Horn 2013-12-10 10:02 ` Andreas Politz 2013-12-10 11:58 ` Andreas Politz 2013-12-10 16:56 ` Andreas Politz 2013-12-10 20:07 ` Tassilo Horn 2013-12-10 22:16 ` Andreas Politz 2013-12-11 4:43 ` Stefan Monnier 2013-12-11 19:08 ` Tassilo Horn 2013-12-20 8:00 ` Tassilo Horn 2013-12-20 8:28 ` Andreas Politz 2013-12-20 13:02 ` Tassilo Horn 2014-04-02 14:43 ` Stefan Monnier 2014-04-04 13:43 ` Tassilo Horn 2014-04-04 15:14 ` Stefan Monnier 2014-04-04 15:53 ` Tassilo Horn 2014-04-04 16:04 ` Glenn Morris 2014-04-04 17:44 ` Tassilo Horn 2013-12-20 14:33 ` Stefan Monnier 2013-12-20 14:36 ` Tassilo Horn
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.