all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Make M-x woman respect display-buffer-alist
@ 2015-06-19 15:03 Kaushal
  2015-06-24 16:02 ` Michael Heerdegen
  0 siblings, 1 reply; 18+ messages in thread
From: Kaushal @ 2015-06-19 15:03 UTC (permalink / raw)
  To: Emacs developers

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

Hi,

I was trying to make the WoMan buffers open as I intend to using
display-buffer-alist. But that was not working.

So I dug into the woman.el source and made these edits:

(defun WoMan-find-buffer ()
  "Switch to buffer corresponding to `woman-buffer-number' and return it.
If such a buffer does not exist then remove its association from the
alist in `woman-buffer-alist' and return nil."
  (if (zerop woman-buffer-number)
      (let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
(if buffer
            ;; (switch-to-buffer buffer) ; Edit
            (display-buffer buffer) ; Edit
          ;; Delete alist element:
          (setq woman-buffer-alist (cdr woman-buffer-alist))
          nil))
    (let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
           (buffer (get-buffer (cdr (car (cdr prev-ptr))))))
      (if buffer
          ;; (switch-to-buffer buffer) ; Edit
          (display-buffer buffer) ; Edit
        ;; Delete alist element:
        (setcdr prev-ptr (cdr (cdr prev-ptr)))
        (if (>= woman-buffer-number (length woman-buffer-alist))
            (setq woman-buffer-number 0))
        nil))))

(defun woman-really-find-file (filename compressed bufname)
  "Find, decompress, and decode a UN*X man page FILENAME.
If COMPRESSED is non-nil, turn on auto-compression mode to decompress
the file if necessary.  Set buffer name BUFNAME and major mode.
Do not call directly!"
  (let ((WoMan-current-file filename)) ; used for message logging
    (if woman-use-own-frame
(select-frame
 (or (and (frame-live-p woman-frame) woman-frame)
     (setq woman-frame (make-frame)))))
    (set-buffer (get-buffer-create bufname))
    (condition-case nil
        ;; (switch-to-buffer (current-buffer)) ; Edit
        (display-buffer (current-buffer)) ; Edit
      (error (pop-to-buffer (current-buffer))))
    (buffer-disable-undo)
    (setq buffer-read-only nil)
    (erase-buffer) ; NEEDED for reformat
    (woman-insert-file-contents filename compressed)
    ;; Set buffer's default directory to that of the file.
    (setq default-directory (file-name-directory filename))
    (set (make-local-variable 'backup-inhibited) t)
    (set-visited-file-name "")
    (woman-process-buffer)))

The edited lines have the "; Edit" comments.

I simply replaced `switch-to-buffer' with `display-buffer' at 3 places.

If doing so does not have any unexpected bad outcomes, can that change be
made in the master?

PS: Not sure if this should have been a bug report; so posted here.

[-- Attachment #2: Type: text/html, Size: 3746 bytes --]

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

end of thread, other threads:[~2015-08-24 10:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-19 15:03 Make M-x woman respect display-buffer-alist Kaushal
2015-06-24 16:02 ` Michael Heerdegen
2015-07-13 15:06   ` bug#21047: 25.0.50; " Kaushal
2015-08-20 17:35     ` Kaushal
2015-08-21  5:42       ` Stefan Monnier
2015-08-21 11:17         ` Kaushal
2015-08-21 12:25           ` martin rudalics
2015-08-21 12:30             ` Kaushal
2015-08-21 13:36               ` Kaushal
2015-08-21 15:11                 ` martin rudalics
2015-08-21 15:13                   ` Kaushal
2015-08-21 15:16                     ` Kaushal
2015-08-21 15:30                       ` martin rudalics
2015-08-21 15:33                         ` Kaushal
2015-08-21 15:58                           ` martin rudalics
2015-08-21 16:00                             ` Kaushal
2015-08-24  8:16                     ` martin rudalics
2015-08-24 10:46                       ` Kaushal Modi

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.