For my writing courses, about 5% of students will come to me prior to deadlines asking for help with their paper. I see no problem advising students, as I often similarly came for help when I was an undergraduate. Recently, though, I found an increase in students who apparently just want to abuse this:


Students will bring me some plagiarized work, showing it to me early, as a sort of test if I will notice. It seems difficult to punish plagiarism when the paper is not yet submitted.
Students will bring in papers again and again, with little changes put in at each stage, hoping their minimal effort each time will be sufficient to reach their goal of a "D".


I've tried stopping students, but then they are angry when they see the "F" that they hoped I would help them get away from. While most of these students are probably just incredibly lazy, there is a chance that some among them are genuinely trying to improve, but just struggling a great deal, and I can't see it.

How might I go about blocking such abuses?


Question: \jobname in Gummi
Answer: Taking a look at the 'Build Log' I get with a foo.tex test file, it seems Gummi actually compiles .foo.tex.swp, which is hidden on Unix due to the leading ., and which has extension .swp not .tex. So TeX is showing you the correct information. For example, with demo file

\documentclass{article}
\begin{document}
Hello world
\end{document}


saved as foo.tex I get log

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
 \write18 enabled.
entering extended mode
(/home/joseph/Desktop/.foo.tex.swp
LaTeX2e &lt;2011/06/27&gt;
Babel &lt;v3.8m&gt; and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, 
kurmanji, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk,
 polish, portuguese, romanian, romansh, russian, sanskrit, serbian, serbianc, s
lovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, 
welsh, loaded.
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/size10.clo))
(/tmp/.foo.tex.aux) [1{/usr/local/texlive/2012/texmf-var/fonts/map/pdftex/updma
p/pdftex.map}] (/tmp/.foo.tex.aux) )&lt;/usr/local/texlive/2012/texmf-dist/fonts/t
ype1/public/amsfonts/cm/cmr10.pfb&gt;
Output written on /tmp/.foo.tex.pdf (1 page, 11541 bytes).
SyncTeX written on /tmp/.foo.tex.synctex.gz.
Transcript written on /tmp/.foo.tex.log.


I'm afraid I don't have a solution (other than 'use a different editor'), as there does not seem to be a Gummi setting to alter this behaviour.



The edited question asks for a 'flexible' approach based on Herbert's code. With the restriction that this assumes a simple case (the file name contains only a single . to separate the extension, except if it starts .where Gummi is in use):

\makeatletter
\begingroup
  \def\@jobname#1.#2\q@nil{%
    \ifx\relax#1\relax
      \expandafter\expandafter\expandafter\@@jobname
    \else
      \expandafter\@@@jobname
    \fi
      \jobname\q@nil
  }
  \def\@@jobname.#1.#2\q@nil{#1}
  \def\@@@jobname#1\q@nil{#1}
  \xdef\jobname{\expandafter\@jobname\jobname.\q@nil}
\endgroup
\makeatother