all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Quickly check for differences in code and locate possible errors.
@ 2023-03-28 13:56 Hongyi Zhao
  2023-03-28 14:40 ` gebser
  2023-03-28 15:03 ` Gregory Heytings
  0 siblings, 2 replies; 5+ messages in thread
From: Hongyi Zhao @ 2023-03-28 13:56 UTC (permalink / raw)
  To: help-gnu-emacs

Hi here,

I've the following two lines of wolfram code written in two versions:

Version 1. This is the correct version:

getPGRotMat =getRotMat[If[MemberQ[RotMat[[1]]["CubiPrim"],
#],"CubiPrim","HexaPrim"],#]&;
Grid[Table[{PGinfo[[i,;;2]],{#\[RightArrow]getPGRotMat[#]} &
/@getPGElem[i]},{i,32}],Frame -> All]

Version 2. This is the wrong version:

getPGRotMat =getRotMat[If[MemberQ[RotMat[[1]]["CubiPrim"],#],"CubiPrim","HexaPrim"],#]&;
Grid[Table[{PGinfo[i,;;2],{#\[RightArrow]getPGRotMat[#]} &
/@getPGElem[i]},{i,3}],Frame \[RightArrow] All]

I would like to know whether it's possible to quickly check for
differences in code and locate possible errors with the help of Emacs.
Any tips will be appreciated.

Regards,
Zhao
-- 
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



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

* Re: Quickly check for differences in code and locate possible errors.
  2023-03-28 13:56 Quickly check for differences in code and locate possible errors Hongyi Zhao
@ 2023-03-28 14:40 ` gebser
  2023-03-28 15:03 ` Gregory Heytings
  1 sibling, 0 replies; 5+ messages in thread
From: gebser @ 2023-03-28 14:40 UTC (permalink / raw)
  To: help-gnu-emacs

On 3/28/23 9:56 AM, Hongyi Zhao wrote:
> Hi here,
> 
> I've the following two lines of wolfram code written in two versions:
> 
> Version 1. This is the correct version:
> 
> getPGRotMat =getRotMat[If[MemberQ[RotMat[[1]]["CubiPrim"],
> #],"CubiPrim","HexaPrim"],#]&;
> Grid[Table[{PGinfo[[i,;;2]],{#\[RightArrow]getPGRotMat[#]} &
> /@getPGElem[i]},{i,32}],Frame -> All]
> 
> Version 2. This is the wrong version:
> 
> getPGRotMat =getRotMat[If[MemberQ[RotMat[[1]]["CubiPrim"],#],"CubiPrim","HexaPrim"],#]&;
> Grid[Table[{PGinfo[i,;;2],{#\[RightArrow]getPGRotMat[#]} &
> /@getPGElem[i]},{i,3}],Frame \[RightArrow] All]
> 
> I would like to know whether it's possible to quickly check for
> differences in code and locate possible errors with the help of Emacs.
> Any tips will be appreciated.
> 
> Regards,
> Zhao

It's been a long time since I've compiled something in an emacs buffer, 
so I can't speak to locating code errors, and have no experience with 
wolfram.  "C-h a diff ENTER" displays a few possibilities for finding 
differences.



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

* Re: Quickly check for differences in code and locate possible errors.
  2023-03-28 13:56 Quickly check for differences in code and locate possible errors Hongyi Zhao
  2023-03-28 14:40 ` gebser
@ 2023-03-28 15:03 ` Gregory Heytings
  2023-03-29  2:04   ` Hongyi Zhao
  1 sibling, 1 reply; 5+ messages in thread
From: Gregory Heytings @ 2023-03-28 15:03 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


>
> I would like to know whether it's possible to quickly check for 
> differences in code and locate possible errors with the help of Emacs. 
> Any tips will be appreciated.
>

I think the simplest way to do what you want is:

(defun ediff-regions-characterwise ()
   (interactive)
   (let ((ediff-forward-word-function #'forward-char))
     (call-interactively 'ediff-regions-wordwise)))

Open the two files, call M-x ediff-regions-characterwise, select the two 
buffers, and type C-x h C-M-c twice.




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

* Re: Quickly check for differences in code and locate possible errors.
  2023-03-28 15:03 ` Gregory Heytings
@ 2023-03-29  2:04   ` Hongyi Zhao
  2023-03-29  8:34     ` Gregory Heytings
  0 siblings, 1 reply; 5+ messages in thread
From: Hongyi Zhao @ 2023-03-29  2:04 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: help-gnu-emacs

On Tue, Mar 28, 2023 at 11:03 PM Gregory Heytings <gregory@heytings.org> wrote:
>
>
> >
> > I would like to know whether it's possible to quickly check for
> > differences in code and locate possible errors with the help of Emacs.
> > Any tips will be appreciated.
> >
>
> I think the simplest way to do what you want is:
>
> (defun ediff-regions-characterwise ()
>    (interactive)
>    (let ((ediff-forward-word-function #'forward-char))
>      (call-interactively 'ediff-regions-wordwise)))
>
> Open the two files, call M-x ediff-regions-characterwise, select the two
> buffers, and type C-x h C-M-c twice.

Thank you for the tip. Now, let's consider a further problem: if I
only have the wrong version of the code at hand, I want to quickly
locate the possible problematic code characters from it. Is it
possible?

More specifically, the culprit should be picked out, and the
corresponding modifications should be made as follows:

`,' should be `,'

`\[RightArrow]' should be `->'

Regards,
Zhao



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

* Re: Quickly check for differences in code and locate possible errors.
  2023-03-29  2:04   ` Hongyi Zhao
@ 2023-03-29  8:34     ` Gregory Heytings
  0 siblings, 0 replies; 5+ messages in thread
From: Gregory Heytings @ 2023-03-29  8:34 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs


>
> Now, let's consider a further problem: if I only have the wrong version 
> of the code at hand, I want to quickly locate the possible problematic 
> code characters from it. Is it possible?
>

If you can unambiguously define what "possible problematic code 
characters" are (and what their non-problematic counterparts are), that's 
possible.  I don't know enough about Mathematica to help you more, sorry.




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

end of thread, other threads:[~2023-03-29  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-28 13:56 Quickly check for differences in code and locate possible errors Hongyi Zhao
2023-03-28 14:40 ` gebser
2023-03-28 15:03 ` Gregory Heytings
2023-03-29  2:04   ` Hongyi Zhao
2023-03-29  8:34     ` Gregory Heytings

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.