comparison lisp/progmodes/ebrowse.el @ 87903:5d58981e6690

Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1006
author Miles Bader <miles@gnu.org>
date Tue, 22 Jan 2008 23:53:46 +0000
parents 107ccd98fa12 7305b32a846c
children c70e45a7acfd 1e3a407766b9
comparison
equal deleted inserted replaced
87902:2080d155f7aa 87903:5d58981e6690
1612 (unless file-name 1612 (unless file-name
1613 (error "File `%s' not found" file)) 1613 (error "File `%s' not found" file))
1614 file-name)) 1614 file-name))
1615 1615
1616 1616
1617 (defun ebrowse-view-file-other-window (file)
1618 "View a file FILE in another window.
1619 This is a replacement for `view-file-other-window' which does not
1620 seem to work. It should be removed when `view.el' is fixed."
1621 (interactive)
1622 (let ((old-arrangement (current-window-configuration))
1623 (had-a-buf (get-file-buffer file))
1624 (buf-to-view (find-file-noselect file)))
1625 (switch-to-buffer-other-window buf-to-view)
1626 (view-mode-enter old-arrangement
1627 (and (not had-a-buf)
1628 (not (buffer-modified-p buf-to-view))
1629 'kill-buffer))))
1630
1631
1632 (defun ebrowse-view-exit-fn (buffer) 1617 (defun ebrowse-view-exit-fn (buffer)
1633 "Function called when exiting View mode in BUFFER. 1618 "Function called when exiting View mode in BUFFER.
1634 Restore frame configuration active before viewing the file, 1619 Restore frame configuration active before viewing the file,
1635 and possibly kill the viewed buffer." 1620 and possibly kill the viewed buffer."
1636 (let (exit-action original-frame-configuration) 1621 (let (exit-action original-frame-configuration)
1647 (funcall exit-action buffer)))) 1632 (funcall exit-action buffer))))
1648 1633
1649 1634
1650 (defun ebrowse-view-file-other-frame (file) 1635 (defun ebrowse-view-file-other-frame (file)
1651 "View a file FILE in another frame. 1636 "View a file FILE in another frame.
1652 The new frame is deleted when it is no longer used." 1637 The new frame is deleted when you quit viewing the file in that frame."
1653 (interactive) 1638 (interactive)
1654 (let ((old-frame-configuration (current-frame-configuration)) 1639 (let ((old-frame-configuration (current-frame-configuration))
1655 (old-arrangement (current-window-configuration))
1656 (had-a-buf (get-file-buffer file)) 1640 (had-a-buf (get-file-buffer file))
1657 (buf-to-view (find-file-noselect file))) 1641 (buf-to-view (find-file-noselect file)))
1658 (switch-to-buffer-other-frame buf-to-view) 1642 (switch-to-buffer-other-frame buf-to-view)
1659 (make-local-variable 'ebrowse--frame-configuration) 1643 (make-local-variable 'ebrowse--frame-configuration)
1660 (setq ebrowse--frame-configuration old-frame-configuration) 1644 (setq ebrowse--frame-configuration old-frame-configuration)
1661 (make-local-variable 'ebrowse--view-exit-action) 1645 (make-local-variable 'ebrowse--view-exit-action)
1662 (setq ebrowse--view-exit-action 1646 (setq ebrowse--view-exit-action
1663 (and (not had-a-buf) 1647 (and (not had-a-buf)
1664 (not (buffer-modified-p buf-to-view)) 1648 (not (buffer-modified-p buf-to-view))
1665 'kill-buffer)) 1649 'kill-buffer))
1666 (view-mode-enter old-arrangement 'ebrowse-view-exit-fn))) 1650 (view-mode-enter (cons (selected-window) (cons (selected-window) t))
1667 1651 'ebrowse-view-exit-fn)))
1668 1652
1669 (defun ebrowse-view/find-file-and-search-pattern 1653 (defun ebrowse-view/find-file-and-search-pattern
1670 (struc info file tags-file-name &optional view where) 1654 (struc info file tags-file-name &optional view where)
1671 "Find or view a member or class. 1655 "Find or view a member or class.
1672 STRUC is an `ebrowse-bs' structure (or a structure including that) 1656 STRUC is an `ebrowse-bs' structure (or a structure including that)
1697 ebrowse-temp-info-to-view info) 1681 ebrowse-temp-info-to-view info)
1698 (unless (boundp 'view-mode-hook) 1682 (unless (boundp 'view-mode-hook)
1699 (setq view-mode-hook nil)) 1683 (setq view-mode-hook nil))
1700 (push 'ebrowse-find-pattern view-mode-hook) 1684 (push 'ebrowse-find-pattern view-mode-hook)
1701 (case where 1685 (case where
1702 (other-window (ebrowse-view-file-other-window file)) 1686 (other-window (view-file-other-window file))
1703 (other-frame (ebrowse-view-file-other-frame file)) 1687 (other-frame (ebrowse-view-file-other-frame file))
1704 (t (view-file file)))) 1688 (t (view-file file))))
1705 (t 1689 (t
1706 (case where 1690 (case where
1707 (other-window (find-file-other-window file)) 1691 (other-window (find-file-other-window file))