all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Telling auctex to format a user-defined command as \item ?
@ 2014-09-19 16:08 Adam Funk
  2014-09-20  9:30 ` Tassilo Horn
       [not found] ` <mailman.9255.1411205467.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Funk @ 2014-09-19 16:08 UTC (permalink / raw)
  To: help-gnu-emacs

(Crossposted; please feel free to follow-up to either group as I read
both of them.)

I have the following definitions in the preamble:

#v+
\newcommand{\slug}{\hspace{1.0em}}
\newcommand{\object}[1]{\textsf{#1}}
\newcommand{\method}[3]{\item{\slug}\object{#1}{\slug}\url{#2}{\slug}#3}
#v-

So I have lists with this sort of thing:

#v+
\begin{itemize}
  \method{GET}{http://localhost:port/documents}{lists all document ids.}
  \method ...
#v-

The formatting commands (indent-region, fill-region, etc.) aren't
keeping the \method commands on separate lines (like \item) because
latex-mode/auctex doesn't know what they are.  What magic do I need to
use to tell it to format \method like \item?

Thanks,
Adam


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

* Re: Telling auctex to format a user-defined command as \item ?
  2014-09-19 16:08 Telling auctex to format a user-defined command as \item ? Adam Funk
@ 2014-09-20  9:30 ` Tassilo Horn
       [not found] ` <mailman.9255.1411205467.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2014-09-20  9:30 UTC (permalink / raw)
  To: Adam Funk; +Cc: help-gnu-emacs

Adam Funk <a24061@ducksburg.com> writes:

Hi Adam,

> I have the following definitions in the preamble:
>
> #v+
> \newcommand{\slug}{\hspace{1.0em}}
> \newcommand{\object}[1]{\textsf{#1}}
> \newcommand{\method}[3]{\item{\slug}\object{#1}{\slug}\url{#2}{\slug}#3}
> #v-
>
>
> So I have lists with this sort of thing:
>
> #v+
> \begin{itemize}
>   \method{GET}{http://localhost:port/documents}{lists all document ids.}
>   \method ...
> #v-
>
> The formatting commands (indent-region, fill-region, etc.) aren't
> keeping the \method commands on separate lines (like \item) because
> latex-mode/auctex doesn't know what they are.  What magic do I need to
> use to tell it to format \method like \item?

Does it help to adapt `LaTeX-item-regexp' so that it also recognizes
your \method macros at items?

Bye,
Tassilo



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

* Re: Telling auctex to format a user-defined command as \item ?
       [not found] ` <mailman.9255.1411205467.1147.help-gnu-emacs@gnu.org>
@ 2014-09-20 20:03   ` Adam Funk
  2014-09-21  8:13     ` Tassilo Horn
       [not found]     ` <mailman.9287.1411287238.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Funk @ 2014-09-20 20:03 UTC (permalink / raw)
  To: help-gnu-emacs

On 2014-09-20, Tassilo Horn wrote:

> Adam Funk <a24061@ducksburg.com> writes:
...
>> So I have lists with this sort of thing:
>>
>> #v+
>> \begin{itemize}
>>   \method{GET}{http://localhost:port/documents}{lists all document ids.}
>>   \method ...
>> #v-
>>
>> The formatting commands (indent-region, fill-region, etc.) aren't
>> keeping the \method commands on separate lines (like \item) because
>> latex-mode/auctex doesn't know what they are.  What magic do I need to
>> use to tell it to format \method like \item?
>
> Does it help to adapt `LaTeX-item-regexp' so that it also recognizes
> your \method macros at items?

Good suggestion!  I found the following in .emacs from a previous
customization to handle \boxedverbatim & such:

#v+
(defcustom LaTeX-verbatim-regexp ".*verbatim\\*?"
  "*Regexp matching environments with indentation at col 0 for begin/end."
  :group 'LaTeX-indentation
  :type 'regexp)
#v-

and, working from that & the output of C-h f LaTeX-item-regexp,
arrived at this

#v+
(defcustom LaTeX-item-regexp "\\(\\(bib\\)?item\\|method\\)\\b"
  "*Regular expression matching macros considered items."
  :group 'LaTeX-indentation
  :type 'regexp)
#v-

which works!  

Thanks very much for putting me on the right track.

Adam


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

* Re: Telling auctex to format a user-defined command as \item ?
  2014-09-20 20:03   ` Adam Funk
@ 2014-09-21  8:13     ` Tassilo Horn
       [not found]     ` <mailman.9287.1411287238.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2014-09-21  8:13 UTC (permalink / raw)
  To: Adam Funk; +Cc: help-gnu-emacs

Adam Funk <a24061@ducksburg.com> writes:

Hi Adam,

> Good suggestion!  I found the following in .emacs from a previous
> customization to handle \boxedverbatim & such:
>
> #v+
> (defcustom LaTeX-verbatim-regexp ".*verbatim\\*?"
>   "*Regexp matching environments with indentation at col 0 for begin/end."
>   :group 'LaTeX-indentation
>   :type 'regexp)
> #v-
>
> and, working from that & the output of C-h f LaTeX-item-regexp,
> arrived at this
>
> #v+
> (defcustom LaTeX-item-regexp "\\(\\(bib\\)?item\\|method\\)\\b"
>   "*Regular expression matching macros considered items."
>   :group 'LaTeX-indentation
>   :type 'regexp)
> #v-
>
> which works!  
>
> Thanks very much for putting me on the right track.

Good, but you shouldn't use `defcustom' for your configurations else the
emacs help facilities will say that those variables are defined in your
init file, won't show the real (upstream) default values, and the links
go into you init file instead to the file where the package in question
defines the variable.  Use a simple `setq'.

  (setq LaTeX-verbatim-regexp ".*verbatim\\*?"
        LaTeX-item-regexp "\\(\\(bib\\)?item\\|method\\)\\b")

Bye,
Tassilo



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

* Re: Telling auctex to format a user-defined command as \item ?
       [not found]     ` <mailman.9287.1411287238.1147.help-gnu-emacs@gnu.org>
@ 2014-09-24 15:00       ` Adam Funk
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Funk @ 2014-09-24 15:00 UTC (permalink / raw)
  To: help-gnu-emacs

On 2014-09-21, Tassilo Horn wrote:

> Good, but you shouldn't use `defcustom' for your configurations else the
> emacs help facilities will say that those variables are defined in your
> init file, won't show the real (upstream) default values, and the links
> go into you init file instead to the file where the package in question
> defines the variable.  Use a simple `setq'.
>
>   (setq LaTeX-verbatim-regexp ".*verbatim\\*?"
>         LaTeX-item-regexp "\\(\\(bib\\)?item\\|method\\)\\b")

I've changed it to that & it works too.  I can't explain where I got
the defcustom from --- I must've seen it in some similar-looking
situation & misadopted it.  thanks.


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

end of thread, other threads:[~2014-09-24 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-19 16:08 Telling auctex to format a user-defined command as \item ? Adam Funk
2014-09-20  9:30 ` Tassilo Horn
     [not found] ` <mailman.9255.1411205467.1147.help-gnu-emacs@gnu.org>
2014-09-20 20:03   ` Adam Funk
2014-09-21  8:13     ` Tassilo Horn
     [not found]     ` <mailman.9287.1411287238.1147.help-gnu-emacs@gnu.org>
2014-09-24 15:00       ` Adam Funk

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.