[OS X TeX] TeXShop: a way to automate terminating each line in a block with a comment symbol

Michael Sharpe via MacOSX-TeX macosx-tex at email.esm.psu.edu
Mon May 18 06:58:45 CEST 2020


Hi Murray,

My feed from this list is no longer reliable as I seem not to receive a number of messages that are referenced by later emails, so I'm not entirely sure that I'm understanding what it is you need. Nonetheless, here is a macro that solves what I think is the problem you are asking about. When you select text is the frontmost document and call this macro, it replaces all <whitespace}+<endofline> with "%"<endofline>.

The plist should be installed into the Macros Menu just like any other such plist, as documented in the TeXShop docs.

Best,
Michael



> On May 17, 2020, at 5:33 PM, Murray Eisenberg <murrayeisenberg at gmail.com> wrote:
> 
> On 17 May2020, at 3:53 PM, Herbert Schulz <herbs at wideopenwest.com <mailto:herbs at wideopenwest.com>> wrote:
>> 
>>> On May 17, 2020, at 2:36 PM, Murray Eisenberg <murrayeisenberg at gmail.com <mailto:murrayeisenberg at gmail.com>> wrote:
>>> 
>>> It’s worth saying three things for this procedure:
>>> 
>>> 	(a) This method is possible only when using the OgreKit Find Panel.
>>> 
>>> 	(b) It does not work as I’d expect if there are trailing blanks in one of the block’s lines, as it leaves those unwanted blanks there.
>>> 
>>> 	(c) [of course] one also has to check the “Selection” option of the Scope section in the OgreKit Find Panel.
>>> 
>>> ** It would still be very nice to have a TeXShop menu items, or at least a macro, to do this operation.
>>> 
>>> Compare, for example, BBEdit, where after selecting a block of lines, one uses the Text > Prefix/Suffix Lines menu item and then just enters the desired prefix or suffix in the resulting pop-up window.  (Albeit that suffers from the same trailing-blank issue.) I suspect other programmers’ text editors have similar built-in menu items or macros.
>>> 
>>>> On 17 May2020, at 6:37 AM, Luis Sequeira <lfsequeira at gmail.com <mailto:lfsequeira at gmail.com>> wrote:
>>>> 
>>>> 1) Select the block of text where you want to add the comment sign.
>>>> 
>>>> 2) Press Command-F to open the Find window
>>>> 
>>>> 3) Chech the box for "Regular Expressions"
>>>>  Make sure that you have selected Origin: "Top" and Scope: "Selection"
>>>> 
>>>>  Type "$" (without quotes) in the search box
>>>>  Type "%" (without quotes) in the replace box
>>>>  Press Replace All
>>> 
>> 
>> Howdy,
>> 
>> How I wish the Ogrekit find panel was fixed for Catalina, especially to get it to work properly in Dark Mode.
>> 
>> Take a look at the Cot Editor (available for free via the App Store). It has a beautiful regex ready Find Panel that works beautifully in Dark Mode. It would be wonderful is someone could get that to work in TeXShop. PS: the Cot Editor is Open Software written in Swift with freely available source code.
>> 
>> u/mailman/listinfo/macosx-tex <https://urldefense.com/v3/__https://email.esm.psu.edu/mailman/listinfo/macosx-tex__;!!Mih3wA!TmYjcfVgC7XceqlH--ECBZew63EkibBgVRR-Wcusjpw2Qp7Gb2b66dZ8Zax5i6w$>
> 
> Using the specified regexs in the OgreKit panel worked just fine.
> 
> Unfortunately, I never really learned regexs, so in any task requiring one I need explicit instructions on exactly what to do.
> 
> In TeXShop we already have a really easy-to-use menu item, plus associated keystroke shortcut, to comment a selected block of lines.
> Given that defining multi-line commands is hardly unknown to TeXers, even non-experts like me, a corresponding menu command/shortcut to comment end of lines would be genuine convenience.
> ---
> Murray Eisenberg			murrayeisenberg at gmail.com <mailto:murrayeisenberg at gmail.com>
> 503 King Farm Blvd #101	Home (240)-246-7240
> Rockville, MD 20850-6667	Mobile (413)-427-5334
> 
> 
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: https://urldefense.com/v3/__http://www.tex.ac.uk/faq__;!!Mih3wA!TmYjcfVgC7XceqlH--ECBZew63EkibBgVRR-Wcusjpw2Qp7Gb2b66dZ89r7SRf0$ 
> List Reminders and Etiquette: https://urldefense.com/v3/__https://sites.esm.psu.edu/*gray/tex/__;fg!!Mih3wA!TmYjcfVgC7XceqlH--ECBZew63EkibBgVRR-Wcusjpw2Qp7Gb2b66dZ8QrtzZfE$ 
> List Archives: https://urldefense.com/v3/__http://dir.gmane.org/gmane.comp.tex.macosx__;!!Mih3wA!TmYjcfVgC7XceqlH--ECBZew63EkibBgVRR-Wcusjpw2Qp7Gb2b66dZ83gNi63c$ 
>                https://urldefense.com/v3/__https://email.esm.psu.edu/pipermail/macosx-tex/__;!!Mih3wA!TmYjcfVgC7XceqlH--ECBZew63EkibBgVRR-Wcusjpw2Qp7Gb2b66dZ8oFDMyFs$ 
> TeX on Mac OS X Website: https://urldefense.com/v3/__http://mactex-wiki.tug.org/__;!!Mih3wA!TmYjcfVgC7XceqlH--ECBZew63EkibBgVRR-Wcusjpw2Qp7Gb2b66dZ8zot6LfE$ 
> List Info: https://urldefense.com/v3/__https://email.esm.psu.edu/mailman/listinfo/macosx-tex__;!!Mih3wA!TmYjcfVgC7XceqlH--ECBZew63EkibBgVRR-Wcusjpw2Qp7Gb2b66dZ8Zax5i6w$ 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200517/6e9580fd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: commentEnds.plist
Type: application/octet-stream
Size: 1502 bytes
Desc: not available
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200517/6e9580fd/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20200517/6e9580fd/attachment-0001.html>
-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


More information about the macostex-archives mailing list.