all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: ??? <netjune@icloud.com>, 20266@debbugs.gnu.org
Subject: bug#20266: Emacs doesn't respond when editing the attached c header	file.
Date: 7 Apr 2015 15:16:16 -0000	[thread overview]
Message-ID: <20150407151616.87042.qmail@mail.muc.de> (raw)
In-Reply-To: <mailman.71.1428315070.904.bug-gnu-emacs@gnu.org>

Hello, Netjune.

In article <mailman.71.1428315070.904.bug-gnu-emacs@gnu.org> you wrote:
> [-- text/plain, encoding 7bit, charset: us-ascii, 13 lines --]

> Emacs doesn't respond when editing the attached c header file.
> Emacs version: 24.4.

> ------------------------------------
> Run emacs with "emacs -Q test.h".
> M-x mark-whole-buffer
> M-x kill-ring-save
> M-x end-of-buffer
> M-x yank
> Then emacs doesn't respond for about 5 seconds.
> M-x scroll-down-command. 
> Then emacs doesn't respond for about 5 seconds too.

Yes.  This isn't good at all.

> M-x scroll-down-command.
> Then emacs doesn't respond for about 5 seconds too.

I can't actually reproduce this delay.

There is special handling on `yank' for some arcane mechanisms in Emacs,
and these simply waste time in CC Mode for no productive purpose.  The
patch below should switch off this processing.



diff -r 5cc874770a5d cc-mode.el
--- a/cc-mode.el        Tue Apr 07 10:25:37 2015 +0000
+++ b/cc-mode.el        Tue Apr 07 14:58:37 2015 +0000
@@ -502,6 +502,7 @@
   (make-local-variable 'adaptive-fill-mode)
   (make-local-variable 'adaptive-fill-regexp)
   (make-local-variable 'fill-paragraph-handle-comment)
+  (make-local-variable 'yank-handled-properties)

   ;; now set their values
   (setq parse-sexp-ignore-comments t
@@ -511,6 +512,12 @@
        comment-multi-line t
        comment-line-break-function 'c-indent-new-comment-line)

+  ;; Prevent time-wasting activity on C-y.
+  (let ((yank-cat-handler (assq 'category yank-handled-properties)))
+    (when yank-cat-handler
+      (setq yank-handled-properties (remq yank-cat-handler
+                                         yank-handled-properties))))
+
   ;; For the benefit of adaptive file, which otherwise mis-fills.
   (setq fill-paragraph-handle-comment nil)
 



Please try applying this patch to .../emacs/lisp/progmodes/cc-mode.el,
then recompiling that file with either:

(on the command line):
    $ emacs -Q -batch -f batch-byte-compile .../path/to/cc-mode.el

, or (from within Emacs):
    M-x byte-compile-file <CR> .../path/to/cc-mode.el.

Either load this file (with M-x load-file) or restart Emacs.  Hopefully
the first problem (with M-x yank) will have gone away.

Could you please get back to me and confirm that the M-x yank delay has
gone, and let me know whether the delay on M-x scroll-down-command is
still a problem.

Thanks for taking the trouble to report this bug.

-- 
Alan Mackenzie (Nuremberg, Germany).






  parent reply	other threads:[~2015-04-07 15:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-06 10:09 bug#20266: Emacs doesn't respond when editing the attached c header file 张海君
     [not found] ` <mailman.71.1428315070.904.bug-gnu-emacs@gnu.org>
2015-04-07 15:16   ` Alan Mackenzie [this message]
2015-04-12  2:15     ` 张海君
2015-04-21 16:14       ` Alan Mackenzie
2015-04-25 21:11         ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150407151616.87042.qmail@mail.muc.de \
    --to=acm@muc.de \
    --cc=20266@debbugs.gnu.org \
    --cc=netjune@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.