all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Error when editing C code
@ 2022-06-15 19:59 T.V Raman
  2022-06-15 20:17 ` Andreas Schwab
  2022-06-16  9:38 ` Alan Mackenzie
  0 siblings, 2 replies; 7+ messages in thread
From: T.V Raman @ 2022-06-15 19:59 UTC (permalink / raw)
  To: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 7334 bytes --]

Appears to be due to incorrect loading of macros in cc-mode.

If I try editing a c/c++ file, I get this backtrace.

This emacs from Git @HEAD, I even did a make distclean followed by a
rebuild  but the error persists.

Debugger entered--Lisp error: (void-function c-with-string-fences)
  (c-with-string-fences nil nil nil nil t nil nil t (c-depropertize-new-text c-after-change-escape-NL-in-string c-after-change-unmark-ml-strings c-parse-quotes-after-change c-after-change-mark-abnormal-strings c-extend-font-lock-region-for-macros c-neutralize-syntax-in-CPP c-restore-<>-properties c-change-expand-fl-region))
  (c-after-change 2617 2617 6)
  (delete-and-extract-region 2617 2623)
  (#f(compiled-function (beg end delete) #<bytecode -0xb2965821e55dad>) 2617 2623 delete)
  (apply #f(compiled-function (beg end delete) #<bytecode -0xb2965821e55dad>) (2617 2623 delete))
  (#f(compiled-function (funs global args) #<bytecode -0x508bbc66466722>) nil nil (2617 2623 delete))
  (buffer-substring--filter 2617 2623 delete)
  (filter-buffer-substring 2617 2623 delete)
  (#f(compiled-function (beg end &optional region) "Kill (\"cut\") text between point and mark.\nThis deletes the text from the buffer and saves it in the kill ring.\nThe command \\[yank] can retrieve it from there.\n(If you want to save the region without killing it, use \\[kill-ring-save].)\n\nIf you want to append the killed region to the last killed text,\nuse \\[append-next-kill] before \\[kill-region].\n\nAny command that calls this function is a \"kill command\".\nIf the previous command was also a kill command,\nthe text killed this time appends to the text killed last time\nto make one entry in the kill ring.\n\nThe killed text is filtered by `filter-buffer-substring' before it is\nsaved in the kill ring, so the actual saved text might be different\nfrom what was killed.\n\nIf the buffer is read-only, Emacs will beep and refrain from deleting\nthe text, but put the text in the kill ring anyway.  This means that\nyou can use the killing commands to copy text from a read-only buffer.\n\nLisp programs should use this function for killing text.\n (To delete text, use `delete-region'.)\nSupply two arguments, character positions BEG and END indicating the\n stretch of text to be killed.  If the optional argument REGION is\n non-nil, the function ignores BEG and END, and kills the current\n region instead.  Interactively, REGION is always non-nil, and so\n this command always kills the current region." (interactive #f(compiled-function () #<bytecode -0x1aacdb1bd27856fc>)) #<bytecode -0x436d732fd395672>) 2617 2623 nil)
  (ad-Advice-kill-region #f(compiled-function (beg end &optional region) "Kill (\"cut\") text between point and mark.\nThis deletes the text from the buffer and saves it in the kill ring.\nThe command \\[yank] can retrieve it from there.\n(If you want to save the region without killing it, use \\[kill-ring-save].)\n\nIf you want to append the killed region to the last killed text,\nuse \\[append-next-kill] before \\[kill-region].\n\nAny command that calls this function is a \"kill command\".\nIf the previous command was also a kill command,\nthe text killed this time appends to the text killed last time\nto make one entry in the kill ring.\n\nThe killed text is filtered by `filter-buffer-substring' before it is\nsaved in the kill ring, so the actual saved text might be different\nfrom what was killed.\n\nIf the buffer is read-only, Emacs will beep and refrain from deleting\nthe text, but put the text in the kill ring anyway.  This means that\nyou can use the killing commands to copy text from a read-only buffer.\n\nLisp programs should use this function for killing text.\n (To delete text, use `delete-region'.)\nSupply two arguments, character positions BEG and END indicating the\n stretch of text to be killed.  If the optional argument REGION is\n non-nil, the function ignores BEG and END, and kills the current\n region instead.  Interactively, REGION is always non-nil, and so\n this command always kills the current region." (interactive #f(compiled-function () #<bytecode -0x1aacdb1bd27856fc>)) #<bytecode -0x436d732fd395672>) 2617 2623)
  (apply ad-Advice-kill-region #f(compiled-function (beg end &optional region) "Kill (\"cut\") text between point and mark.\nThis deletes the text from the buffer and saves it in the kill ring.\nThe command \\[yank] can retrieve it from there.\n(If you want to save the region without killing it, use \\[kill-ring-save].)\n\nIf you want to append the killed region to the last killed text,\nuse \\[append-next-kill] before \\[kill-region].\n\nAny command that calls this function is a \"kill command\".\nIf the previous command was also a kill command,\nthe text killed this time appends to the text killed last time\nto make one entry in the kill ring.\n\nThe killed text is filtered by `filter-buffer-substring' before it is\nsaved in the kill ring, so the actual saved text might be different\nfrom what was killed.\n\nIf the buffer is read-only, Emacs will beep and refrain from deleting\nthe text, but put the text in the kill ring anyway.  This means that\nyou can use the killing commands to copy text from a read-only buffer.\n\nLisp programs should use this function for killing text.\n (To delete text, use `delete-region'.)\nSupply two arguments, character positions BEG and END indicating the\n stretch of text to be killed.  If the optional argument REGION is\n non-nil, the function ignores BEG and END, and kills the current\n region instead.  Interactively, REGION is always non-nil, and so\n this command always kills the current region." (interactive #f(compiled-function () #<bytecode -0x1aacdb1bd27856fc>)) #<bytecode -0x436d732fd395672>) (2617 2623))
  (kill-region 2617 2623)
  (#f(compiled-function (arg) "Kill characters forward until encountering the end of a word.\nWith argument ARG, do this that many times." (interactive "p") #<bytecode -0xe1aa8af62fe5343>) 1)
  (ad-Advice-kill-word #f(compiled-function (arg) "Kill characters forward until encountering the end of a word.\nWith argument ARG, do this that many times." (interactive "p") #<bytecode -0xe1aa8af62fe5343>) 1)
  (apply ad-Advice-kill-word #f(compiled-function (arg) "Kill characters forward until encountering the end of a word.\nWith argument ARG, do this that many times." (interactive "p") #<bytecode -0xe1aa8af62fe5343>) 1)
  (kill-word 1)
  (#<subr funcall-interactively> kill-word 1)
  (apply #<subr funcall-interactively> kill-word 1)
  (ad-Advice-funcall-interactively #<subr funcall-interactively> kill-word 1)
  (apply ad-Advice-funcall-interactively #<subr funcall-interactively> (kill-word 1))
  (funcall-interactively kill-word 1)
  (#<subr call-interactively> kill-word nil nil)
  (apply #<subr call-interactively> kill-word (nil nil))
  (call-interactively@ido-cr+-record-current-command #<subr call-interactively> kill-word nil nil)
  (apply call-interactively@ido-cr+-record-current-command #<subr call-interactively> (kill-word nil nil))
  (call-interactively kill-word nil nil)
  (command-execute kill-word)


-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1  •0Ü8

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮



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

* Re: Error when editing C code
  2022-06-15 19:59 Error when editing C code T.V Raman
@ 2022-06-15 20:17 ` Andreas Schwab
  2022-06-15 20:29   ` T.V Raman
  2022-06-15 21:24   ` T.V Raman
  2022-06-16  9:38 ` Alan Mackenzie
  1 sibling, 2 replies; 7+ messages in thread
From: Andreas Schwab @ 2022-06-15 20:17 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

On Jun 15 2022, T.V Raman wrote:

> This emacs from Git @HEAD, I even did a make distclean followed by a
> rebuild  but the error persists.

Try make bootstrap.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



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

* Re: Error when editing C code
  2022-06-15 20:17 ` Andreas Schwab
@ 2022-06-15 20:29   ` T.V Raman
  2022-06-15 21:24   ` T.V Raman
  1 sibling, 0 replies; 7+ messages in thread
From: T.V Raman @ 2022-06-15 20:29 UTC (permalink / raw)
  To: schwab; +Cc: raman, emacs-devel

My build script does bootstrap automatically if it has run distclean,
but I'll try that again by hand.
Andreas Schwab writes:
 > On Jun 15 2022, T.V Raman wrote:
 > 
 > > This emacs from Git @HEAD, I even did a make distclean followed by a
 > > rebuild  but the error persists.
 > 
 > Try make bootstrap.
 > 
 > -- 
 > Andreas Schwab, schwab@linux-m68k.org
 > GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
 > "And now for something completely different."

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮



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

* Re: Error when editing C code
  2022-06-15 20:17 ` Andreas Schwab
  2022-06-15 20:29   ` T.V Raman
@ 2022-06-15 21:24   ` T.V Raman
  2022-06-16  5:10     ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: T.V Raman @ 2022-06-15 21:24 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 229 bytes --]

So make bootstrap didd fix it.

Wondering why make distclean followed by a full build doesn't fix these
types of things; 
-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1  •0Ü8



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

* Re: Error when editing C code
  2022-06-15 21:24   ` T.V Raman
@ 2022-06-16  5:10     ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2022-06-16  5:10 UTC (permalink / raw)
  To: T.V Raman; +Cc: schwab, emacs-devel

> From: "T.V Raman" <raman@google.com>
> Cc: emacs-devel@gnu.org
> Date: Wed, 15 Jun 2022 14:24:36 -0700
> 
> So make bootstrap didd fix it.
> 
> Wondering why make distclean followed by a full build doesn't fix these
> types of things; 

"make distclean" isn't supposed to make the tree clean enough.  You
need extraclean instead, AFAIR.

"make distclean"s purpose is to be used in trees created by unpacking
a release tarball, so it deliberately doesn't remove *.elc files,
because those come with the tarball.




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

* Re: Error when editing C code
  2022-06-15 19:59 Error when editing C code T.V Raman
  2022-06-15 20:17 ` Andreas Schwab
@ 2022-06-16  9:38 ` Alan Mackenzie
  2022-06-16 13:52   ` T.V Raman
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2022-06-16  9:38 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel, Andreas Schwab, Eli Zaretskii

Hello, Raman.

On Wed, Jun 15, 2022 at 12:59:39 -0700, T.V Raman wrote:
> Appears to be due to incorrect loading of macros in cc-mode.

> If I try editing a c/c++ file, I get this backtrace.

> This emacs from Git @HEAD, I even did a make distclean followed by a
> rebuild  but the error persists.

> Debugger entered--Lisp error: (void-function c-with-string-fences)
>   (c-with-string-fences nil nil nil nil t nil nil t (c-depropertize-new-text c-after-change-escape-NL-in-string c-after-change-unmark-ml-strings c-parse-quotes-after-change c-after-change-mark-abnormal-strings c-extend-font-lock-region-for-macros c-neutralize-syntax-in-CPP c-restore-<>-properties c-change-expand-fl-region))
>   (c-after-change 2617 2617 6)
>   (delete-and-extract-region 2617 2623)

[ .... ]

Noting that make bootstrap has fixed the problem, I am unhappy that the
problem occurred in the first place.  c-with-string-fences is a new
macro in cc-defs.el (in lisp/progmodes/).  c-after-change is a function
in cc-mode.el.

There is a section in lisp/Makefile specifically for dependencies in
cc-*.el, and this should have picked up the change in cc-defs.elc and
rebuild (amongs others) cc-mode.elc.  That section looks like:

#########################################################################
$(lisp)/progmodes/cc-align.elc\
 $(lisp)/progmodes/cc-cmds.elc $(lisp)/progmodes/cc-compat.elc\
 $(lisp)/progmodes/cc-engine.elc $(lisp)/progmodes/cc-fonts.elc\
 $(lisp)/progmodes/cc-langs.elc $(lisp)/progmodes/cc-menus.elc\
 $(lisp)/progmodes/cc-mode.elc $(lisp)/progmodes/cc-styles.elc\  <======
 $(lisp)/progmodes/cc-vars.elc: \
   $(lisp)/progmodes/cc-bytecomp.elc $(lisp)/progmodes/cc-defs.elc
#########################################################################

So, why was cc-mode.elc not rebuilt with the new cc-defs.elc?

> -- 

> Thanks,

> --Raman(I Search, I Find, I Misplace, I Research)
> ♈ Id: kg:/m/0285kf1  🦮

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: Error when editing C code
  2022-06-16  9:38 ` Alan Mackenzie
@ 2022-06-16 13:52   ` T.V Raman
  0 siblings, 0 replies; 7+ messages in thread
From: T.V Raman @ 2022-06-16 13:52 UTC (permalink / raw)
  To: acm; +Cc: raman, emacs-devel, schwab, eliz

Agreed, would be nice to get this cleaned up.

The error when it occurs is very difficult to explain or track down.

In my case it first occured with eglot and the root caused appeared to
be fontification of markdown within C comments, which durprized me
because I didn't have any markdown in my C comments:-)

I finally tracked it down by writing a simple C file with no comments,
no eglot running, and then deleting a word triggered the error.

Alan Mackenzie writes:
 > Hello, Raman.
 > 
 > On Wed, Jun 15, 2022 at 12:59:39 -0700, T.V Raman wrote:
 > > Appears to be due to incorrect loading of macros in cc-mode.
 > 
 > > If I try editing a c/c++ file, I get this backtrace.
 > 
 > > This emacs from Git @HEAD, I even did a make distclean followed by a
 > > rebuild  but the error persists.
 > 
 > > Debugger entered--Lisp error: (void-function c-with-string-fences)
 > >   (c-with-string-fences nil nil nil nil t nil nil t (c-depropertize-new-text c-after-change-escape-NL-in-string c-after-change-unmark-ml-strings c-parse-quotes-after-change c-after-change-mark-abnormal-strings c-extend-font-lock-region-for-macros c-neutralize-syntax-in-CPP c-restore-<>-properties c-change-expand-fl-region))
 > >   (c-after-change 2617 2617 6)
 > >   (delete-and-extract-region 2617 2623)
 > 
 > [ .... ]
 > 
 > Noting that make bootstrap has fixed the problem, I am unhappy that the
 > problem occurred in the first place.  c-with-string-fences is a new
 > macro in cc-defs.el (in lisp/progmodes/).  c-after-change is a function
 > in cc-mode.el.
 > 
 > There is a section in lisp/Makefile specifically for dependencies in
 > cc-*.el, and this should have picked up the change in cc-defs.elc and
 > rebuild (amongs others) cc-mode.elc.  That section looks like:
 > 
 > #########################################################################
 > $(lisp)/progmodes/cc-align.elc\
 >  $(lisp)/progmodes/cc-cmds.elc $(lisp)/progmodes/cc-compat.elc\
 >  $(lisp)/progmodes/cc-engine.elc $(lisp)/progmodes/cc-fonts.elc\
 >  $(lisp)/progmodes/cc-langs.elc $(lisp)/progmodes/cc-menus.elc\
 >  $(lisp)/progmodes/cc-mode.elc $(lisp)/progmodes/cc-styles.elc\  <======
 >  $(lisp)/progmodes/cc-vars.elc: \
 >    $(lisp)/progmodes/cc-bytecomp.elc $(lisp)/progmodes/cc-defs.elc
 > #########################################################################
 > 
 > So, why was cc-mode.elc not rebuilt with the new cc-defs.elc?
 > 
 > > -- 
 > 
 > > Thanks,
 > 
 > > --Raman(I Search, I Find, I Misplace, I Research)
 > > ♈ Id: kg:/m/0285kf1  🦮
 > 
 > -- 
 > Alan Mackenzie (Nuremberg, Germany).

-- 

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮

--

Thanks,

--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1  🦮



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

end of thread, other threads:[~2022-06-16 13:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15 19:59 Error when editing C code T.V Raman
2022-06-15 20:17 ` Andreas Schwab
2022-06-15 20:29   ` T.V Raman
2022-06-15 21:24   ` T.V Raman
2022-06-16  5:10     ` Eli Zaretskii
2022-06-16  9:38 ` Alan Mackenzie
2022-06-16 13:52   ` T.V Raman

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.