My two cents (I hope it's not unlikely to happen) :
1) have country information (in country.csv for start and in savefile (*) ) : HRE=0 to n
0 = not part of HRE
n = part of HRE and number of votes (n>=1)
+ end_date (number of months from EUII startdate) in country.csv
+ HRE_bonus in country.csv (bonus in election for certain countries like Austria)
2) have province information : HRE=0 (not part) or 1 (part) in savefile
+ end_date (number of months from EUII startdate) in province.csv
Logic :
When date reaches end_date for a province => province in savefile HRE=0
When date reaches end_date for a country => country in savefile HRE=0 (*)
=> "natural" shrinking of 1640 (iirc)
When HRE (or former HRE) country conquests (or by defection or as revolter) HRE province before province end_date (information in province.csv) => province in savefile HRE=1
When not (and not former) HRE country conquests (or by defection or as revolter) HRE province => province in savefile HRE=0
So, when HRE country reaches his end_date, it is no more involved in election but doesn't shrink HRE. For country who were not part of HRE at any time in game period but do not shrink HRE, as Poland, the solution is in country.csv as HRE=1 and end_date=0 (immediatly)
With this, HRE is to be drawn by provinces with HRE=1 in savefile
And, for election, apply actual rule with informations in country.csv
I hope number of votes didn't change in game period...
If yes, we need an extra command "modifyHRE" in events for countries in order to change number of votes in savefile and this information is to be taken for elections in savefile and not in country.csv.
If not, HRE information is useless for countries in savefile (*)
Last thing, I hope any former HRE country was able to shrink HRE after his end_date

o
What do you think of this ?
Am I dreaming ?