Subject: Re: bug#17365: 24.3; Visiting tags table in combination with fill column indicator causes Emacs to hang

From: Jon Dufresne <[email-masked]>
Date: Tue, 29 Apr 2014 12:16:30 -0700

On Tue, Apr 29, 2014 at 12:10 PM, Alp Aker <[email-masked]> wrote:
> Jon, could you replace the definition of fci-redraw-region with the
> following and try your recipe again?
>
> (defun fci-redraw-region (start end _ignored)
>   (when (fci-get-buffer-windows t)
>     (save-match-data
>       (save-excursion
>         (let ((inhibit-point-motion-hooks t))
>           (goto-char end)
>           (setq end (line-beginning-position 2))
>           (fci-delete-overlays-region start end)
>           (fci-put-overlays-region start end))))))
>
>

This worked! After adding this function Emacs no longer hangs after
entering "yes".

Thank you very much for the prompt response.

The full working recipe now appears as follows:

---
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(package-refresh-contents)
(package-install 'fill-column-indicator)

(setq debug-on-event 'sigusr2)

(require 'fill-column-indicator)
(setq-default fci-rule-column 80)
(defun fci-mode-on ()
  "Turn fci-mode on."
  (fci-mode 1))
(define-globalized-minor-mode global-fci-mode
  fci-mode
  fci-mode-on)
(global-fci-mode 1)

(defun fci-redraw-region (start end _ignored)
  (when (fci-get-buffer-windows t)
    (save-match-data
      (save-excursion
        (let ((inhibit-point-motion-hooks t))
          (goto-char end)
          (setq end (line-beginning-position 2))
          (fci-delete-overlays-region start end)
          (fci-put-overlays-region start end))))))

(defun project-compile-and-visit-tags-table ()
  "Compile TAGS file at the project ROOT directory."
  (interactive)
  (let ((root (project-root)))
    (when root
      (add-hook 'compilation-finish-functions #'project-visit-tags-table)
      (compile (format "ctags -e -R --languages=PHP -o %s %s"
                       (concat root "TAGS") root)))))

(defun project-visit-tags-table (buffer string)
  "Tell tags commands to use tags table at the project root."
  (when (string= string "finished\n")
    (visit-tags-table (concat (project-root) "TAGS")))
  (remove-hook 'compilation-finish-functions #'project-visit-tags-table))

(defun project-root ()
  "Return the project's root directory."
  (locate-dominating-file default-directory ".hg"))
---